Why does list have no 'get' method?

Stefan Behnel stefan_ml at behnel.de
Thu Feb 7 03:44:29 EST 2008


bearophileHUGS at lycos.com wrote:
> Paul Rubin:
>> 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.
> 
> I think a high-level language like Python must have boolean operators
> (or and not) that behave in a much more clean way, with a simpler
> semantics. That is they have to return only true or false. Otherwise
> they are just a source of bugs and confusion. This is a change fit for
> Python 3.

Conditional expressions have clear semantics.

Stefan



More information about the Python-list mailing list