Re: Lazy container

2007-02-13 Thread Peter Otten
Cristiano Paris wrote: > I'm trying to write a Container which should mimic a list. Basically, > the container pulls items on the fly from an unspecified source through > a function and returns an instance of a given class over the pulled item. > > That is: > > class lazy(object): >def __get

Re: Lazy container

2007-02-13 Thread Cristiano Paris
Duncan Booth wrote: > ... > Yes. Try using weak references. Specifically a weakref.WeakValueDictionary > should meet your needs. :D Thank you. Cristiano -- http://mail.python.org/mailman/listinfo/python-list

Re: Lazy container

2007-02-13 Thread Duncan Booth
Cristiano Paris <[EMAIL PROTECTED]> wrote: > May be someone has faced this problem before and came up with some > obscure language feature to solve this elegantly :D Yes. Try using weak references. Specifically a weakref.WeakValueDictionary should meet your needs. -- http://mail.python.org/mai

Lazy container

2007-02-13 Thread Cristiano Paris
Hi everyone, I'm trying to write a Container which should mimic a list. Basically, the container pulls items on the fly from an unspecified source through a function and returns an instance of a given class over the pulled item. That is: class lazy(object): def __getitem__(self,index):