Alex Martelli wrote: >> (2) >> the second-best solution i could think of is just passing the dict as a >> keyword argument to the class, like so: >> >> class Spam(metaclass = Bacon, dict = {}): >> ... >> >> so you could explicitly state you need a special dict. > > I like this one, with classdict being the keyword (dict is the name of > a builtin type and we shouldn't encourage the frequent but iffy > practice of 'overriding' builtin identifiers).
So instead of being able to write: class MyStruct(Struct): first = 1 second = 2 third = 3 everyone defining a Struct subclass has to write: class MyStruct(Struct, classdict=OrderedDict()): first = 1 second = 2 third = 3 Forgive my confusion, but exactly *how* is that meant to be an improvement? The use of a special ordered dictionary should be an internal implementation detail of the Struct class, and PEP 3115 makes it exactly that. The PEP's approach means that simple cases, while possibly being slightly harder to write, will 'just work' when it comes time to use them, while more complicated cases involving multiple metaclasses should still be possible. I will also note that the PEP allows someone to write their own base class which accepts the 'classdict' keyword argument if they so choose. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com