[Python-Dev] get for lists and tuples?

Russell E. Owen rowen at cesmail.net
Tue Jul 11 19:32:01 CEST 2006


I'd like to have the get method available for lists and tuples. (I 
figured this must have been discussed before but can't recall it and 
didn't turn anything up on google).

It's obviously not a use-all-the-time method (or it'd already be there), 
but I find myself wanting it often enough to justify it in my own mind 
(and curse this omission, relative to dict).

Basically I run into it when parsing data of variable length (where the 
extra elements have some obvious default value), including config files, 
sys.argv (for simple command scripts), that sort of thing.

Yes a 4-liner does the job, but "get" would be a much clearer way to 
write it.

Anyway, I'm just testing the waters. If it's not heresy then I'd like to 
do what I can to make it happen.

-- Russell



More information about the Python-Dev mailing list