[Python-Dev] Non-string keys in type dict
Amaury Forgeot d'Arc
amauryfa at gmail.com
Thu Mar 8 18:41:30 CET 2012
Hi,
2012/3/8 Ethan Furman <ethan at stoneleaf.us>:
>>> A little more experimentation shows that not all is well, however:
>>>
>>> --> dir(Test)
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> TypeError: unorderable types: int() < str()
>>
>>
>> So what conclusion do you draw?
>
>
> That other changes (that have definitely been for the better) are making the
> 'feature' of non-string keys in namespace dicts less and less friendly.
> Rather than letting it slowly fall into complete shambles we should go
> ahead and deprecate, then remove, that functionality.
Not that I disagree with the conclusion, but the obvious thing to do here
is to fix dir() and return only string attributes, i.e. those you can
access with getattr.
Cheers,
--
Amaury Forgeot d'Arc
More information about the Python-Dev
mailing list