A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-January/050912.html below:

getattr and __mro__ (was Re: [Python-Dev] PEP 246, redux)

getattr and __mro__ (was Re: [Python-Dev] PEP 246, redux)Alex Martelli aleax at aleax.it
Wed Jan 12 16:52:53 CET 2005
On 2005 Jan 12, at 16:44, Thomas Heller wrote:
    ...
>>    conform = getattr(type(obj), '__conform__', None)
    ...
> I'm confused.  Do you mean that
>
>    getattr(obj, "somemethod")(...)
>
> does something different than
>
>    obj.somemethod(...)
>
> with new style class instances?  Doesn't getattr search the __dict__'s
> along the __mro__ list?

Yes, but getattr(obj, ... ALSO searches obj itself, which is what we're 
trying to avoid here.

getattr(type(obj), ... OTOH has a DIFFERENT problem -- it ALSO searches 
type(type(obj)), the metaclass, which we DON'T want.


Alex

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4