Re: appending to a list via properties

2006-02-12 Thread Peter Otten
[Alex Martelli] > If you want to hoist for performance, you can hoist more: > > appenders = foo.append, qux.append > while some_condition: > for appender, anitem in zip(appenders, calculate_something()): > appender(anitem) You are of course claiming a performance improvement over Car

Re: appending to a list via properties

2006-02-11 Thread Alex Martelli
Xavier Morel <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Carl Banks <[EMAIL PROTECTED]> wrote: > >... > >>> class better_list (list): > >>> tail = property(None, list.append) > >> This is an impressive, spiffy little class. > > > > Yes, nice use of property. > > > > Ale

Re: appending to a list via properties

2006-02-11 Thread Xavier Morel
Alex Martelli wrote: > Carl Banks <[EMAIL PROTECTED]> wrote: >... >>> class better_list (list): >>> tail = property(None, list.append) >> This is an impressive, spiffy little class. > > Yes, nice use of property. > > Alex I don't know, I usually see people considering that proper

Re: appending to a list via properties

2006-02-11 Thread Carl Banks
Alex Martelli wrote: > Carl Banks <[EMAIL PROTECTED]> wrote: >... > > > class better_list (list): > > > tail = property(None, list.append) > > > > This is an impressive, spiffy little class. > > Yes, nice use of property. > > > growing_lists = foo,qux > > while some_condition: > >

Re: appending to a list via properties

2006-02-11 Thread Alex Martelli
Carl Banks <[EMAIL PROTECTED]> wrote: ... > > class better_list (list): > > tail = property(None, list.append) > > This is an impressive, spiffy little class. Yes, nice use of property. > growing_lists = foo,qux > while some_condition: > for (s,x) in zip(growing_list,calculate

Re: appending to a list via properties

2006-02-11 Thread Carl Banks
Lonnie Princehouse wrote: > Here's a curious hack I want to put up for discussion. I'm thinking of > writing a PEP for it. A minor library change wouldn' t need a PEP. > Observation > - > I found myself using this construct for assembling multiple lists: > > foo = [] > qu

Re: appending to a list via properties

2006-02-10 Thread Larry Bates
Lonnie Princehouse wrote: > Here's a curious hack I want to put up for discussion. I'm thinking of > writing a PEP for it. > > Observation > - > I found myself using this construct for assembling multiple lists: > > foo = [] > qux = [] > > while some_condition: >

appending to a list via properties

2006-02-10 Thread Lonnie Princehouse
Here's a curious hack I want to put up for discussion. I'm thinking of writing a PEP for it. Observation - I found myself using this construct for assembling multiple lists: foo = [] qux = [] while some_condition: a, b = calculate_something() foo.append