[Python-Dev] Sorting

Steven D'Aprano steve at pearwood.info
Wed Apr 5 22:24:47 EDT 2017


On Thu, Apr 06, 2017 at 02:30:06AM +0200, Oleg Broytman wrote:

>    Sorry, let me pour a bit of cold water here. Recently I was busy
> porting a few big and small (but complex) programs to Python 3 and was
> sending thousands curses every day. str=>unicode is the biggest change
> but not the most painful. The worst was when I spent few days hunting
> for a subtle bug caused by absent of unbound methods.
>    Painful. :-(

I'm curious about this. What do you mean? Python 3 has unbound methods, 
they're just the original, unwrapped function:

py> class K:
...     def method(self, arg):
...             pass
...
py> K.method
<function K.method at 0xb7cbd6a4>


The only(?) functional difference between unbound methods in Python 2 
versus 3 is that in Python 2 they automatically do a type-check that 
`self` is an instance of the class.



-- 
Steve


More information about the Python-Dev mailing list