<built-in method sort of list object at 0x10794e488>
>>> [].sort
<built-in method sort of list object at 0x10794e6c8>
>>> [].sort
<built-in method sort of list object at 0x10794e488>
>>> [].sort
<built-in method sort of list object at 0x10794e6c8>
Why python methods are stored in two different addresses?
it's not the address of the method, but of the object.
you create a new list object each time.
if you save it in a variable, you'll get the same address (and for all methods...)
>>> a = []
>>> a.sort
<built-in method sort of list object at 0x7f78138fa688>
>>> a.sort
<built-in method sort of list object at 0x7f78138fa688>
>>> a.count
<built-in method sort of list object at 0x7f78138fa688>
>>> a.index
<built-in method sort of list object at 0x7f78138fa688>
>>>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With