summaryrefslogtreecommitdiffstats
path: root/Lib/UserDict.py
Commit message (Collapse)AuthorAgeFilesLines
* Register IterableUserDict as a MutableMapping.Georg Brandl2008-06-071-0/+4
|
* Update more instances of has_key().Raymond Hettinger2008-02-211-2/+2
|
* Removed uses of dict.has_key() from distutils, and uses ofGuido van Rossum2008-02-211-1/+1
| | | | | | callable() from copy_reg.py, so the interpreter now starts up without warnings when '-3' is given. More work like this needs to be done in the rest of the stdlib.
* - Patch 1433928:Guido van Rossum2006-02-251-1/+6
| | | | | | | | - The copy module now "copies" function objects (as atomic objects). - dict.__getitem__ now looks for a __missing__ hook before raising KeyError. - Added a new type, defaultdict, to the collections module. This uses the new __missing__ hook behavior added to dict (see above).
* Use decorators.Guido van Rossum2005-01-161-1/+1
|
* The default argument in dict.setdefault() defaults to None.Walter Dörwald2004-05-271-1/+1
| | | | Add this default to UserDict.DictMixin.setdefault() too.
* SF #904720: dict.update should take a 2-tuple sequence like dict.__init_Raymond Hettinger2004-03-041-11/+17
| | | | | | | | (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments.
* Make sure the UserDict copies do not share the same underlyingRaymond Hettinger2003-12-211-1/+1
| | | | | | | dictionary as the original. This parallels MvL's change to Lib/os.py 1.56. Backport candidate.
* SF bug #849662. Dramatically, improve comparison speed for "if shl == None".Raymond Hettinger2003-12-041-0/+2
|
* SF patch #693753: fix for bug 639806: default for dict.popRaymond Hettinger2003-03-061-4/+12
| | | | (contributed by Michael Stone.)
* typo in commentBarry Warsaw2003-01-311-1/+1
|
* SF patch #667730: More DictMixinRaymond Hettinger2003-01-221-2/+4
| | | | | | Sebastien Keim pointed out that iterkeys and __contains__ require their own definitions so their behavior will update when the underlying method is subclassed.
* Bring UserDict in-sync with changes to dict.Raymond Hettinger2002-11-271-6/+12
| | | | | | Constructor accepts optional keyword arguments after a optional items list. Add fromkeys() as an alternate constructor from an iterable over keys. Expand related unittests.
* Implement dict() style constructor.Raymond Hettinger2002-11-221-3/+8
| | | | | | | | | | | Already supported dict() and dict(mapping). Now supports dict(itemsequence) and Just van Rossum's new syntax for dict(keywordargs). Also, added related unittests. The docs already promise dict-like behavior so no update is needed there.
* Improve DictMixin.Raymond Hettinger2002-11-181-23/+38
| | | | | | | | | | | Replaced docstring with comments. Prevents subclass contamination. Added the missing __cmp__() method and a test for __cmp__(). Used try/except style in preference to has_key() followed by a look-up. Used iteritem() where possible to save creating a long key list and to save redundant lookups. Expanded .update() to look for the most helpful methods first and gradually work down to a mininum expected interface. Expanded documentation to be more clear on how to use the class.
* SF patch #520382: Expand shelve.py to have a full dictionary interfaceRaymond Hettinger2002-11-151-0/+64
| | | | | and add a mixin to UserDict.py to make it easier to implement a full dictionary interface.
* Add pop() to UserDict.Guido van Rossum2002-04-131-0/+2
|
* copy(): Make sure the copy of a derived class cannot share the data of theFred Drake2001-11-051-1/+8
| | | | | | original by replacing self.data temporarily, then using the update() method on the new mapping object to populate it. This closes SF bug #476616.
* Remove the __iter__ method from the UserDict class -- it can silentlyGuido van Rossum2001-08-071-0/+2
| | | | | | | | | | break old code (in extreme cases). See SF bug #448153. Add a new subclass IterableUserDict that has the __iter__ method. Note that for new projects, unless backwards compatibility with pre-2.2 Python is required, subclassing 'dictionary' is recommended; UserDict might become deprecated.
* Patch #413171: Implement get, setdefault, update in terms ofMartin v. Löwis2001-06-181-5/+7
| | | | has_key, __getitem__, and __setitem__.
* Added support for .iteritems(), .iterkeys(), .itervalues().Fred Drake2001-05-031-0/+3
|
* Give UserDict new __contains__ and __iter__ methods.Tim Peters2001-04-211-0/+4
|
* removed __all__ from several modulesSkip Montanaro2001-02-181-2/+0
|
* added __all__ lists to a number of Python modulesSkip Montanaro2001-01-201-0/+2
| | | | | | | | added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
* Add popitem().Guido van Rossum2000-12-121-0/+2
|
* Barry's patch to implement the new setdefault() method.Guido van Rossum2000-08-081-0/+4
|
* Mass patch by Ka-Ping Yee:Guido van Rossum2000-02-021-1/+1
| | | | | | | | | | | 1. Comments at the beginning of the module, before functions, and before classes have been turned into docstrings. 2. Tabs are normalized to four spaces. Also, removed the "remove" function from dircmp.py, which reimplements list.remove() (it must have been very old).
* Improved a bunch of things.Guido van Rossum1999-03-261-13/+16
| | | | | The constructor now takes an optional dictionary. Use isinstance() where appropriate.
* Mass check-in after untabifying all files that need it.Guido van Rossum1998-03-261-15/+15
|
* UserDict.get(): New method to mirror built-in dictionaries' get()Barry Warsaw1997-10-061-0/+5
| | | | method.
* Fix bug in copy() by using copy.copy() instead of making assumptionsGuido van Rossum1997-06-031-31/+25
| | | | | (it so happens that copy.copy() works fine for the base UserDict type). Also reindented the entire module to have 4-space indents.
* Added the new dictionary methods to the wrapper class.Fred Drake1997-06-031-0/+16
|
* * test_*.py: new lambda syntax (also affects tests for filter, map,Guido van Rossum1993-11-301-0/+18
reduce) * ftplib.py: added default callback for retrlines; added dir() method * ftplib.py: don't return self in self.connect(); added hack so that if 'CDUP' is not understood, 'CWD ..' is tried. * ftplib.py: second method called init() should have been called connect(); if __init__ sees more than one argument, it will also try to login().