new.instancemethod questions

schickb schickb at gmail.com
Fri Jan 30 03:48:39 CET 2009


I'd like to add bound functions to instances, and found the
instancemethod function in the new module. A few questions:

1. Why is instancemethod even needed? Its counter-intuitive (to me at
least) that assigning a function to a class results in bound functions
its instances, while assigning directly to instances does not create a
bound function. So why doesn't assigning a function to an instance
attribute result in a function bound to that instance?

2. The 2.6 docs say the new module is depreciated and refers to the
types module instead. But I haven't found a way to create bound
functions using the types module. Am I just missing something?

Thanks,
-Brad



More information about the Python-list mailing list