comparing class methods
Posted: Thu May 28, 2020 3:07 pm
I noticed something about micropython that breaks my code:
On micropython on x86 I get slightly different output for x.x:
but the resulting comparison of x.x==x.x is still False on both micropythons.
In normal python the output is:
Code: Select all
>>> class a():
... def x(self):
... pass
...
>>> x=a()
>>> x.x
<bound_method>
>>> x.x==x.x
False
Code: Select all
>>> x.x
<bound_method 7f2fd0491e20 <a object at 7f2fd0491c80>.<function x at 0x7f2fd0491a80>>
In normal python the output is:
Code: Select all
>>> class a():
... def x(self):
... pass
...
>>> x=a()
>>> x.x
<bound method a.x of <__main__.a instance at 0x7f7374d37550>>
>>> x.x == x.x
True