Greg Ewing wrote:
> The main use case for all this seems to be that
> some metaclasses would like to know the order in
> which attributes were defined. So here's an
> alternative proposal: Leave the syntax the way it
> is, and *always* use a specialised dict that
> remembers the order of definition. The metaclass
> can then use that information or ignore it as it
> wishes.

I'm not sure that this is the *only* use case for overriding the 
locals() dict at class definition time, but at the moment I can't think 
of any others. So I won't try to struggle too hard against this idea.

Do you have a specific proposal as to how the information about the 
ordering of definitions could be extracted? I'm assuming that there 
would be an extra attribute that would return a list of keys in the 
order that they were defined. One tricky part here is if the same key 
were to be defined twice (i.e. being overwritten the second time), we 
probably would only want it to appear once, probably at the location 
where it was defined last.

-- Talin
_______________________________________________
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

Reply via email to