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/099463.html below:

[Python-Dev] Very Strange Argument Handling Behavior

[Python-Dev] Very Strange Argument Handling BehaviorDaniel Stutzbach daniel at stutzbachenterprises.com
Fri Apr 16 23:57:19 CEST 2010
On Fri, Apr 16, 2010 at 4:51 PM, Benjamin Peterson <benjamin at python.org>wrote:

> 2010/4/16 Daniel Stutzbach <daniel at stutzbachenterprises.com>:
> > 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.
>
> 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.
>

It would be enough to make the common case fast (1 pointer comparison).  The
error case would need to check all of the keys, true, but that's not really
a performance concern.

Unless you're saying you often create a dictionary, add non-string keys,
remove the non-string keys, then pass it as a **kwds? ;-)
--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100416/193a086f/attachment-0001.html>
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