Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Remove str.find in 3.0?

Wolfgang Lippparagate 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, andi guess everyone here agrees that if it's in the specs doesn't meanit's automatically what we want or expect -- else there's nothing todiscuss. i sayd.get('x') == None<=={ ( 'x' not in d ) OR ( d['x'] == None ) }is not what i expect (even tho the specs say so) especially sinced.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 problematicbehavior (to the point i call it a 'bug' in a jocular way, no offenseimplied). the reason of being for d.get() -- to me -- is simply so youget a chance to pass a default value, which is syntactically well-nighimpossible with d['x']._wolf


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp