Re: possible attribute-oriented class

2009-09-07 Thread Ken Newton
On Mon, Sep 7, 2009 at 6:02 PM, Jan Kaliszewski wrote: ... > > I think it depends how often people need to implement such boiler-plate > code for themselves. Now I see that this thread is not very popular, so > indeed maybe you are right... Though it'd be nice to have OOTB such > a factory in `coll

Re: possible attribute-oriented class

2009-09-04 Thread Ken Newton
On Fri, Sep 4, 2009 at 9:49 PM, Steven D'Aprano wrote: ... > >> The old discussion, the above link points to, shows that such a >> dot-accessible dict-like class is something that many people need and >> repeatedly implemet it (more or less perfectly) for themselves. > > I think it's something whic

Re: possible attribute-oriented class

2009-09-04 Thread Ken Newton
I like this version very much. I'm ready to put this into practice to see how it works in practice. A minor point: I envision this to be used in a context where all key values are strings (legal attribute identifiers). But constructing an AttrClass from a dict or setting values directly with the

Re: possible attribute-oriented class

2009-09-03 Thread Ken Newton
On Thu, Sep 3, 2009 at 4:30 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Thu, 03 Sep 2009 15:46:01 -0700, Ken Newton wrote: > > > I have created the following class definition with the idea of making a > > clean syntax for non-programme

possible attribute-oriented class

2009-09-03 Thread Ken Newton
5 print atr print print repr(atr) print print atr.fourth.aaa = test() gives the following output: { second : 2 fifth : 5 fourth : { aaa : AAA bbb : BBB} third : three first : 1} AttrClass({'second': 2, 'fifth': 5, 'fourth': AttrClass({'aaa': 'AAA', 'bbb': 'BBB'}), 'third': 'three', 'first': 1}) AAA Ken Newton -- http://mail.python.org/mailman/listinfo/python-list