[Doc-SIG] Some random thoughts
Edward Welbourne
Edward Welbourne <eddyw@lsl.co.uk>
Wed, 8 Mar 2000 10:45:18 +0000
>> > try: val = dict[key]
>> > except KeyError: val = default
>> Yeah, that's fairly evil as is the whitespace abuse <wink>.
> Especially because it should be spelled
> val = dict.get(key, default)
Heh. At the end of this week, I leave my present job and finally get to
say goodbye to python 1.3 ... but, until then,
>>> bok = {1:2}
>>> bok.get
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: get
so now you know why I don't write it like that ;^}
Eddy.