[Python-Dev] Should we do away with unbound methods in Py3k?

Nick Coghlan ncoghlan at gmail.com
Sun Nov 25 04:36:26 CET 2007


Guido van Rossum wrote:
> 
> Also, there was discussion of this before:
> http://mail.python.org/pipermail/python-dev/2005-January/050625.html
> -- why didn't we decide to do it then?

Skimming that thread, the issues seem to be:
   - worse error messages from explicit base class calls if you forget 
to supply self
   - breaking code that uses im_func, im_class, im_self

This led to a mixture of a few +1's and several -0's, so it didn't happen.

Py3k severely reduces the weight of the latter objection though, and we 
can use the Py3k warnings feature in 2.6 to complain if any code 
attempts to access im_self, im_class or im_func on an instancemethod 
object when im_class is None.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list