Factory for Struct-like classes
eliben at gmail.com
Tue Aug 19 17:43:27 CEST 2008
On Aug 18, 11:16 am, Gabriel Genellina <gagsl-... at yahoo.com.ar> wrote:
> On 13 ago, 14:46, eliben <eli... at gmail.com> wrote:
> > On Aug 13, 7:30 pm, Christian Heimes <li... at cheimes.de> wrote:
> > > eliben wrote:
> > > > Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
> > > > does this. I suppose it can be done with 'exec', but is there a more
> > > > Pythonic way ?
> > > Try named tuplehttp://code.activestate.com/recipes/500261/
> > 1) I see this is done with exec anyway, so there's no more pythonic
> > way.
> It doesn't *have* to be done with exec - I think there are other
> variants using metaclasses instead.
Can you suggest an alternative, without exec ?
More information about the Python-list