Initializing a list with copies

Thomas Heller theller at python.net
Tue Apr 30 11:47:59 EDT 2002


"Alex Martelli" <aleax at aleax.it> wrote in message news:vIxz8.81546$vF6.2424489 at news2.tin.it...
> Ralf Juengling wrote:
>         ...
> > BTW: It is not easy to add __iter__ to list's meta-type, is it?
>
> list's "metatype" (metaclass) is the built-in type named 'type'.
> like for all other built-in types and new-style classes.  Adding
> __iter__ to type would thus make almost 'everything' iterable.
>
Correction: adding __iter__ to type would make instances of
type iterable (these things are normally called 'classes').
Not too useful, it seems.

Thomas





More information about the Python-list mailing list