Initializing a list with copies

Alex Martelli aleax at aleax.it
Tue Apr 30 13:11:52 EDT 2002


Steve Holden wrote:
        ...
> What you say appears to mean is that iter(type, None), for example, should
> return an unbounded iterator of type. I'd be interested in what you have

type is not callable without arguments.  iter(XX, None) gives an unbounded 
iterator for any XX which is a type callable without arguments: each call
to the iterator's .next() yields [aka, each item in the iterator is] a
"default-initialized" instance of type XX (same as XX() returns).

> if-you-can't-call-a-callable-iterator-why-is-it-
>         -called-a-callable-iterator-ly y'rs  - steve

"Iterator that wraps a callable" might no doubt be a better name.  However:

Much like a burger flipper is not (necessarily) a burger, so is a callable 
iterator not (necessarily) a callable.  "Callable" here is used as a noun
(if any noun can be verbed, why can't adjectives be nouned...?).


Alex




More information about the Python-list mailing list