This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mwh
Recipients
Date 2004-03-01.11:12:38
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=6656

> Metaclasses are not guilty here!

It's more complicated than that.

iter(o) does (roughly)

o->ob_type->tp_iter(o)

At class definition time, if the class defines __iter__, a
wrapper for it is stuffed into the type's tp_iter slot.  If
it doesn't, NULL is placed there instead.

What *could* be done is, if the *meta*class defines
__getattr__ or __getattribute__, all the tp_ slots could be
filled with a special wrapper that calls the generic
attribute getter.  But that would be quite a coding effort,
and these classes would have pretty atrocious performance.

And making this work when you assign to __getattribute__ on
the metaclass would be a truly crazy piece of code.

Or the docs could note this limitation.
History
Date User Action Args
2007-08-23 14:16:07adminlinkissue789262 messages
2007-08-23 14:16:07admincreate