| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
- 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).
|
| |
|
|
|
|
| |
Add this default to UserDict.DictMixin.setdefault() too.
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
|
| |
dictionary as the original. This parallels MvL's change to
Lib/os.py 1.56.
Backport candidate.
|
| |
|
|
|
|
| |
(contributed by Michael Stone.)
|
| |
|
|
|
|
|
|
| |
Sebastien Keim pointed out that iterkeys and __contains__ require
their own definitions so their behavior will update when the
underlying method is subclassed.
|
|
|
|
|
|
| |
Constructor accepts optional keyword arguments after a optional items list.
Add fromkeys() as an alternate constructor from an iterable over keys.
Expand related unittests.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
and add a mixin to UserDict.py to make it easier to implement a full
dictionary interface.
|
| |
|
|
|
|
|
|
| |
original by replacing self.data temporarily, then using the update() method
on the new mapping object to populate it.
This closes SF bug #476616.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
has_key, __getitem__, and __setitem__.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
The constructor now takes an optional dictionary.
Use isinstance() where appropriate.
|
| |
|
|
|
|
| |
method.
|
|
|
|
|
| |
(it so happens that copy.copy() works fine for the base UserDict
type). Also reindented the entire module to have 4-space indents.
|
| |
|
|
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().
|