A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-March/002671.html below:

[Python-Dev] dict.supplement() (was Re: list.shift())

[Python-Dev] dict.supplement() (was Re: list.shift()) [Python-Dev] dict.supplement() (was Re: list.shift())Fred L. Drake, Jr. fdrake@acm.org
Mon, 20 Mar 2000 14:02:48 -0500 (EST)
Peter Funk writes:
 > Ouppss... I should have tested this before posting.  But currently I use 
 > the more explicit (and probably slower version) in my code:

  The performance is based entirely on the size of each; in the
(probably typical) case of smallish dictionaries (<50 entries), it's
probably cheaper to use a temporary dict and do the update.
  For large dicts (on the defaults side), it may make more sense to
reduce the number of objects that need to be created:

       target = ...
       has_key = target.has_key
       for key in defaults.keys():
           if not has_key(key):
               target[key] = defaults[key]

  This saves the construction of len(defaults) 2-tuples.


  -Fred

--
Fred L. Drake, Jr.	  <fdrake at acm.org>
Corporation for National Research Initiatives



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