[Python-Dev] Remove str.find in 3.0?
Wolfgang Lipp
paragate at gmx.net
Sat Aug 27 13:33:40 CEST 2005
On Sat, 27 Aug 2005 13:01:02 +0200, Just van Rossum <just at letterror.com>
wrote:
> Just because you don't read the documentation and guessed wrong d.get()
> needs to be removed?!?
no, not removed... never said that.
> It's a *feature* of d.get(k) to never raise KeyError. If you need an
> exception, why not just use d[k]?
i agree i misread the specs, but then, i read the specs a lot, and
i guess everyone here agrees that if it's in the specs doesn't mean
it's automatically what we want or expect -- else there's nothing to
discuss. i say
d.get('x') == None
<==
{ ( 'x' not in d ) OR ( d['x'] == None ) }
is not what i expect (even tho the specs say so) especially since
d.pop('x') *does* throw a KeyError when 'x' is not a key in mydict.
ok, pop is not get and so on but still i perceive this a problematic
behavior (to the point i call it a 'bug' in a jocular way, no offense
implied). the reason of being for d.get() -- to me -- is simply so you
get a chance to pass a default value, which is syntactically well-nigh
impossible with d['x'].
_wolf
More information about the Python-Dev
mailing list