How to know that two pyc files contain the same code

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Mar 10 17:52:04 EST 2012


On 2012年3月10日 15:48:48 +0100, Gelonida N wrote:
> Hi,
>> I want to know whether two .pyc files are identical.
>> With identical I mean whether they contain the same byte code.

Define "identical" and "the same".
If I compile these two files:
# file ham.py
x = 23
def func():
 a = 23
 return a + 19
# file = spam.py
def func():
 return 42
tmp = 19
x = 4 + tmp
del tmp
do you expect spam.pyc and ham.pyc to count as "the same"?
-- 
Steven


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /