[Python-Dev] Getting rid of unbound methods: patch available
Nick Coghlan
ncoghlan at iinet.net.au
Mon Jan 17 11:01:27 CET 2005
Guido van Rossum wrote:
> What do people think? (My main motivation for this, as stated before,
> is that it adds complexity without much benefit.)
I'm in favour, since it removes the "an unbound method is almost like a bare
function, only not quite as useful" distinction. It would allow things like
str.join(sep, seq) to work correctly for a Unicode separator. It also allows
'borrowing' of method implementations without inheritance.
I'm a little concerned about the modification to pyclbr_input.py, though (since
it presumably worked before the patch). Was the input file tweaked before or
after the test itself was fixed? (I'll probably get around to trying out the
patch myself, but that will be on Linux as well, so I doubt my results will
differ from yours).
The other question is the pickling example - an unbound method currently stores
meaningful data in im_class, whereas a standard function doesn't have that
association. Any code which makes use of im_class on unbound methods (even
without involving pickling)is going to have trouble with the change. (Someone
else will need to provide a real-life use case though, since I certainly don't
have one).
Regards,
Nick.
--
Nick Coghlan | ncoghlan at email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
More information about the Python-Dev
mailing list