[Python-Dev] Very Strange Argument Handling Behavior

Michael Foord fuzzyman at voidspace.org.uk
Sat Apr 17 02:53:58 CEST 2010


On 17/04/2010 02:43, Greg Ewing wrote:
> Daniel Stutzbach wrote:
>
>> Unless you're saying you often create a dictionary, add non-string 
>> keys, remove the non-string keys, then pass it as a **kwds? ;-)
>
> I think the point is that it would create a very mysterious
> potential failure mode. What would you make of a situation
> where Python says "TypeError: Keyword dict contains non-string
> keys", but upon examination, the dict clearly does not contain
> any such thing?
>
No, if the dictionary is not marked as an all-string dict it can 
fallback to checking. The common case (dict marked as all strings) is fast.

Michael

-- 
http://www.ironpythoninaction.com/



More information about the Python-Dev mailing list