Order in metaclass
Nicolas Fleury
nid_oizo at yahoo.com_remove_the_
Wed Oct 13 14:26:40 EDT 2004
Carlos Ribeiro wrote:
> In this case, yes. But I meant to say that a ordereddict would need to
> make a choice here. Either way, our particular need doesn't seem to be
> common enough to warrant such a patch.
I don't know. Store the order only adds a list that would not affect
lookup performance in the dictionary. Right now, the order is simply
lost; that's not nice. Alphabetical order can be get anytime, so I
really see that as different, since there are a lot of solutions for
these needs, while there's only hacks for our need.
> BTW, I'm curious about why are doing it yourself. In my particular
> case, I'm interested in declarative idioms for templating code: data
> entry forms, configuration files, and similar stuff. I also think
> that, whatever you're looking after, we could share some code and
> experiences, and perhaps bundle it all into a single library. What do
> you think of it?
My solution for now is almost exactly what Peter Otten posted,
consisting only of a metaclass and a base class for attributes. I do
some specific stuff, like instanciate some type stored in the attributes
in each instance. I could inherit from your classes instead, but I
don't have a lot to share for now. But yes, I would like very much to
share what I have once it is completed. What I'm doing looks a lot like
a metastruct module (see example in previous post).
Regards,
Nicolas
More information about the Python-list
mailing list