
Feb. 12, 2010
11:25 p.m.
Nick Coghlan wrote:
I believe it runs afoul of the moratorium, but a getitem() builtin might be a better idea (since it would then work for any class that implements __getitem__).
Not quite the same way, though. The dict get() method knows about the internals of the object, so it can work very efficiently and without danger of masking bugs by catching the wrong exception. A generic getitem() wouldn't be able to do that. -- Greg