AttributeError in "with" statement (3.2.2)
Ethan Furman
ethan at stoneleaf.us
Fri Dec 16 18:26:30 EST 2011
Terry Reedy wrote:
> On 12/16/2011 4:22 AM, Steven D'Aprano wrote:
>> On Thu, 15 Dec 2011 19:39:17 -0500, Terry Reedy wrote:
>> [...]
>>
>> After reading your post, I think I have worked out where our disagreement
>> lies: you think that bound methods and instance methods are not the same
>> thing,
>
> Do you agree that an unbound method and a bound method are different? In
> Python, as indicated by the glossary entry, an unspecified 'method' is
> usually meant to be an unbound method.
I think you two are in violent agreement as far as how Python is
functioning, and the conflict is in the names given to the various
pieces... I think a glossary would help (please correct me):
function: callable code suite
method: function that lives in a class
unbound method: function that lives in a class
bound method: callable wrapper around function that has been extracted
from class that will supply the instance object to the function (note:
Python does not save these, they are recreated at each lookup)
and here is where I think you two diverge:
instance method (Steven): a bound method that has been saved into the
instance __dict__ (no matter how created)
instance method (Terry): a function that must be looked up in the class
Have I missed anything?
Honestly-trying-learn-the-distinctions-ly yours,
~Ethan~
More information about the Python-list
mailing list