[Python-3000] Iterators for dict keys, values, and items == annoying :)

Adam DePrince adam.deprince at gmail.com
Sat Apr 1 04:45:10 CEST 2006


On Fri, 2006-03-31 at 14:34 +1200, Greg Ewing wrote:
> Adam DePrince wrote:
> > Views
> > are not generated, they are either directly implemented, or returned.
> 
> If you're thinking that the object would keep a set of
> pre-allocated views, there's a problem with that --
> the views need to have a reference to the base object,
> thus creating a circular reference.
> 
> The object could perhaps keep a cache of weakly-
> referenced views, returning one of those if it's
> available, otherwise creating a new one.

Yes, we would have to do that.  object->iter relationships work because
the reference is only from the iter back; we don't try to reuse iters as
we would views.

Weak refernces work.  Okay, perhaps parasite views should be handed out
by a callable after all instead of saying "hey, reuse this reference
here."  It would actually be more compatable with what we do, and fit
better with the situation where a views would be created on the fly
(slices?)

- Adam



> 
> --
> Greg
> 
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/adam.deprince%40gmail.com



More information about the Python-3000 mailing list