list_to_dict()

maney at pobox.com maney at pobox.com
Thu Jan 16 13:22:20 EST 2003


Martin v. L?wis <martin at v.loewis.de> wrote:
> maney at pobox.com writes:
> 
>> Of course this relies upon nested scopes as written.
> 
> This limitation is easy to remove

Sure.  One simple way out would be to pass the item and the index list
as arguments; and having read a lot of recipes that dealt with this
relatively recently, the customary default arg hack also occurred to
me.  I have to admit that yours is something completely different,
though!

> and the list comprehension a the same time (OTOH, it relies on lists
> having a __getitem__):

But I *like* list comprehensions!  <wink>

Okay, to work with older versions.  Is __getitem__ itself relatively
recent?





More information about the Python-list mailing list