[Python-ideas] Ordered storage of keyword arguments

Stefan Behnel stefan_ml at behnel.de
Fri Oct 29 07:45:16 CEST 2010

Greg Ewing, 28.10.2010 23:22:
> M.-A. Lemburg wrote:
>> Python has always tried
>> to make the most common use case simple, so asking programmers to
>> use a meta-class to be able to access the order of definitions
>> in a class definition isn't exactly what the normal Python
>> programmer would expect.
> But needing to know the order of definitions in a class
> is a very uncommon thing to want to do in the first
> place.

Uncommon, sure, but there are use cases. A couple of Python based DSLs use 
classes as namespaces. Think of SOAP interface classes or database table 
definitions. In these cases, users usually have the field/column order in 
the back of their head when they write or read the code. So it's actually a 
bit surprising and somewhat error prone when the fields show up in 
arbitrary (and unpredictable!) order at runtime. And even on the same 
system, the order can change arbitrarily when new fields are added.


More information about the Python-ideas mailing list