Why does list have no 'get' method?

Paul Rubin http
Thu Feb 7 01:39:12 EST 2008


"Denis Bilenko" <denis.bilenko at gmail.com> writes:
>     port = sys.argv.get(1) or 8000

I like the suggestion, except it should be

     port = int(sys.argv.get(1, '8000'))

one could imagine your example going wrong in a protocol where 0 is
a valid port number.



More information about the Python-list mailing list