[Python-Dev] Non-string keys in namespace dicts

Nicko van Someren nicko at nicko.org
Sun Dec 2 20:06:29 CET 2007

On 2 Dec 2007, at 03:09, Neil Toronto wrote:

> Are there any use-cases for allowing namespace dicts (such as globals,
> builtins and classes) to have non-string keys? I'm asking because I'm
> planning on accelerating method lookups next, and the possibility of a
> key compare changing the underlying dict could be a major pain. (It  
> was
> a minor pain for globals.)

The only plausible use case I can think of might be wanting to use  
ints or longs as keys, though I've never seen it done.  Of course this  
would be trivial to code around and it seems very much a fringe case,  
so I'd be in favour of deprecating non-string namespace keys if it's  
going to make look-ups go faster.


More information about the Python-Dev mailing list