Gregory Ewing <greg.ew...@canterbury.ac.nz>: > Marko Rauhamaa wrote: >> For (almost) all practical purposes, that is the Python way as well. If >> object instantiation (conceptually) copied the class's methods into the >> object's dict, you'd get the semantics I'm looking for. > > If things worked the way you want, it would be impossible to store a > function in an instance attribute and get it out again *without* it > being treated as a method and getting 'self' added to its arguments. > That would be a considerable nuisance when dealing with callbacks and > the like.
Sorry, you'll have to elaborate. I don't quite follow you. Right now Python generates the trampoline from the class prototype every time you call a method. If the semantics allowed, you could create the trampoline at instantiation time (for better or worse). That way, the problem you seem to be referring to wouldn't materialize. Marko -- https://mail.python.org/mailman/listinfo/python-list