Leif K-Brooks schrieb: > Kay Schluehr wrote: > >>>>list.from_str("abc") > > > > list("a", "b", "c" ) > > > I assume we'll also have list.from_list, list.from_tuple, > list.from_genexp, list.from_xrange, etc.?
One might unify all those factory functions into a single list.from_iter that dispatches to the right constructor that still lives under the hood. More conceptually: there is some abstract iter base class providing a from_iter method which may be overwritten in concrete subclasses like tuple, str or list. I would further suggest a lazy iterator used to evaluate objects when they get accessed the first time: >>> l = lazy( math.exp(100) , 27 ) <lazy-iterator object at 0x4945f0> >>> l[1] 27 The first element won't ever be evaluated if it does not get accessed explicitely. This is some very special kind of partial evaluation/specialization. Kay -- http://mail.python.org/mailman/listinfo/python-list