[Python-Dev] iterzip()

Martin v. Loewis martin@v.loewis.de
02 May 2002 09:10:01 +0200

Tim Peters <tim.one@comcast.net> writes:

> [martin@v.loewis.de]
> > I'd suggest a tp_is_immutable predicate. If a container is immutable
> > and non-cyclic, it can be untracked. A container is non-cyclic if all
> > contained objects are either non-gc, or untracked.
> And none of the contained objects are NULL (else the scheme doesn't even
> work for tuples).

If a tuple contains a NULL, its tp_is_immutable will return false,
hence it won't be untracked, henced it isn't cyclic.

> How do you know which other objects it contains?  Calling tp_traverse and
> seeing whether that ever calls the passed-in visit function doesn't work
> (see the already-repeated discussion about this for tuples).

That's why I propose the tp_is_immutable predicate.