Denis Bilenko wrote: > Raymond Hettinger wrote: >> If positions 0 and 1 are optional, how do you expect to know whether >> "path" is going to be at position 2? This problem doesn't exist with >> dictionaries because the presence or absence of optional entries does >> not affect the key reference to other entries. Accordingly, I >> wouldn't expect that dict.get() would have a parallel list.get() with >> plausible use cases. > > If you want to fill position 2, then positions 0 and 1 are mandatory. > It is the simplest possible option parsing, I didn't said it was the > most flexible :)
d = dict(enumerate(args)) print d[0], d[1], d.get(2) Stefan -- http://mail.python.org/mailman/listinfo/python-list