A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-April/099461.html below:

[Python-Dev] Very Strange Argument Handling Behavior

[Python-Dev] Very Strange Argument Handling Behavior [Python-Dev] Very Strange Argument Handling BehaviorBenjamin Peterson benjamin at python.org
Fri Apr 16 23:51:30 CEST 2010
2010/4/16 Daniel Stutzbach <daniel at stutzbachenterprises.com>:
> On Fri, Apr 16, 2010 at 4:11 PM, Raymond Hettinger
> <raymond.hettinger at gmail.com> wrote:
>>
>> ISTM that making it illegal costs cycles with giving any real benefit.
>> It is reasonably common to accept **kwds and then pass it down
>> to another function.  Do we want to validate the keys of every
>> kwds dict on every call?  Why do we even care?
>
> IIRC, there's a performance hack in dictobject.c that keeps track of whether
> all of the keys are strings or not.  The hack is designed so that lookup
> operations can call the string compare/hash functions directly if possible,
> rather than going through the slower PyObject_ functions.
>
> Consequently, validating **kwds should be cheap.

That won't work. You could put non-string keys in a dictionary and
remove them, but the dictionary would still be in the less optimized
state.



-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4