referring from within containers objects

Sandy Norton sandskyfly at hotmail.com
Mon Mar 10 14:41:28 EST 2003


Dimitris Garanatsios wrote:

> I think that the need of refering to the elements of a container at the 
> time it is created is quite rare and usually means bad design of the 
> data structures it represents. Your proposal would propably require a 
> two step process for the creation of a container (especially for 
> dictionaries) at python's C implementation, unless more strict rules 
> would apply, such as to only refer to elements already specified.
> 
> In case my english confuse anyone (sorry about that...), this means that 
> code like
> 
> lst = [ _[1] + ' ' + _[2], 'Nit', 'Wit' ]
> 
> whould raise some kind of an error.
> 
> In my opinion this whould result in an uglier syntax (for the C level 
> ofcourse) that slows down an object's creation without a good reason...

I see your point, and agree that the added complexity (at the c level)
required to make this happen makes this proposal impractical.

<snip example/>

> Regards,
> Dimitris

cheers,

Sandy.




More information about the Python-list mailing list