Initializing a list with copies
Ralf Juengling
juenglin at informatik.uni-freiburg.de
Wed May 1 11:31:29 EDT 2002
Alex Martelli <aleax at aleax.it> writes:
> Thomas Heller wrote:
>
> Classes (new-style) and built-in types, as I said. Maybe I wasn't
> as clear as needed to express once again the distinction between
> levels -- instances of a metaclass are types (classes), so thanks
> for pointing it out.
>
> > Not too useful, it seems.
Implementing factory functions as iterables seems useful to me. Their
iterators should produce "default instances" of what the factory produces.
The longer I think about it, the more I like the
l = take(n, int)
idea. It is quite intuitive, read "give me n of the things int() produces".
As Alex pointed out, it as easy to make all "new-style" types iterable for
the Python developers -- one just would have to small methods to the meta-
type 'type'...
Thanks for your comments,
Ralf
More information about the Python-list
mailing list