Creating a List of Empty Lists
r.s at XXmindspring.com
Fri Dec 5 23:37:33 CET 2003
"David M. Cooke" wrote ...
> "r.e.s." wrote:
> > But something's wrong with that explanation, because
> > of the following:
> > >>> a = 'gobble'
> > >>> a is 'gobble'
> > True
> > Surely `'gobble'` is not the name of an already-existing
> > object, so I expected exactly the same result as for
> > `100` and ``. What's going on there?
> Actually, your second use of 'gobble' *is* an already-existing object.
> Python 'interns' string constants, i.e., reuses them.
Thanks. That explains it.
More information about the Python-list