why is self not passed to id()? < solved >
Ruediger
larudwer at freenet.de
Thu Sep 4 16:45:15 EDT 2008
castironpi wrote:
>
> The answer is fairly technical. For member functions to be bound to
> instances, they are required to have a __get__ method (which takes
> instance and owner as parameters). 'id' does not.
>
> (Why does 'id' not have a __get__ method?)
>
> By contrast,
>
>>>> set.add
> <method 'add' of 'set' objects>
>>>> dir(_)
> ['__call__', '__class__', '__delattr__', '__doc__', '__get__',
> '__getattribute__
> ', '__hash__', '__init__', '__name__', '__new__', '__objclass__',
> '__reduce__',
> '__reduce_ex__', '__repr__', '__setattr__', '__str__']
>
> 'set.add' does.
Thank you for the quick response.
However it gives me less hope that the little performance hack I had in mind
will ever work.
More information about the Python-list
mailing list