Serhiy Storchaka
052b2dfdc9
bpo-32492: Tweak _collections._tuplegetter. (GH-11367)
...
* Replace the docstrings cache with sys.intern().
* Improve tests.
* Unify names of tp_descr_get and tp_descr_set functions.
2018-12-31 14:15:16 +02:00
Pablo Galindo
3f5fc70c62
bpo-32492: 1.6x speed up in namedtuple attribute access using C fast-path ( #10495 )
...
* bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path
* Add News entry
* fixup! bpo-32492: 2.5x speed up in namedtuple attribute access using C fast path
* Check for tuple in the __get__ of the new descriptor and don't cache the descriptor itself
* Don't inherit from property. Implement GC methods to handle __doc__
* Add a test for the docstring substitution in descriptors
* Update NEWS entry to reflect time against 3.7 branch
* Simplify implementation with argument clinic, better error messages, only __new__
* Use positional-only parameters for the __new__
* Use PyTuple_GET_SIZE and PyTuple_GET_ITEM to tighter the implementation of tuplegetterdescr_get
* Implement __set__ to make tuplegetter a data descriptor
* Use Py_INCREF now that we inline PyTuple_GetItem
* Apply the valid_index() function, saving one test
* Move Py_None test out of the critical path.
2018-12-30 01:24:03 -08:00
Raymond Hettinger
dc9bc54899
Clarify that example in comment is about fromkeys() (GH-8141)
2018-07-06 08:52:26 -07:00
Raymond Hettinger
0c4d20bcaa
Add more detail to the Counter.fromkeys() comment block (GH-8124)
2018-07-05 16:36:24 -07:00
Raymond Hettinger
136c8e0795
Code beautification using f-strings ( #5618 )
2018-02-11 08:00:11 -08:00
Raymond Hettinger
3793f95f98
bpo-32792: Preserve mapping order in ChainMap() (GH-5586)
2018-02-11 00:30:31 -08:00
Serhiy Storchaka
c66f9f8d39
bpo-25988: Emit a warning when use or import ABCs from 'collections'. ( #5460 )
2018-01-31 19:19:33 +02:00
Raymond Hettinger
e6d342156d
bpo-25988: Deprecate exposing collections.abc in collections GH-5414
2018-01-29 08:27:49 -08:00
INADA Naoki
a49ac99029
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)
2018-01-27 14:06:21 +09:00
Raymond Hettinger
3948207c61
bpo-32320: Add default value support to collections.namedtuple() ( #4859 )
2018-01-10 21:45:19 -08:00
Raymond Hettinger
8b57d73639
bpo-28638: Optimize namedtuple() creation time by minimizing use of exec() ( #3454 )
...
* Working draft without _source
* Re-use itemgetter() instances
* Speed-up calls to __new__() with a pre-bound tuple.__new__()
* Add note regarding string interning
* Remove unnecessary create function wrappers
* Minor sync-ups with PR-2736. Mostly formatting and f-strings
* Bring-in qualname/__module fix-ups from PR-2736
* Formally remove the verbose flag and _source attribute
* Restore a test of potentially problematic field names
* Restore kwonly_args test but without the verbose option
* Adopt Inada's idea to reuse the docstrings for the itemgetters
* Neaten-up a bit
* Add news blurb
* Serhiy pointed-out the need for interning
* Jelle noticed as missing f on an f-string
* Add whatsnew entry for feature removal
* Accede to request for dict literals instead keyword arguments
* Leave the method.__module__ attribute pointing the actual location of the code
* Improve variable names and add a micro-optimization for an non-public helper function
* Simplify by in-lining reuse_itemgetter()
* Arrange steps in more logical order
* Save docstring in local cache instead of interning
2017-09-10 10:23:36 -07:00
Jonathan Eunice
faa57cbe70
bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 ( #2179 )
...
* fixed OrderedDict.__init__ docstring re PEP 468
* tightened comment and mirrored to C impl
* added space after period per marco-buttu
* preserved substituted for stable
* drop references to Python 3.6 and PEP 468
2017-09-05 16:23:49 -07:00
Serhiy Storchaka
78d9e58f20
Issues #29311 , #29289 : Fixed and improved docstrings for dict and OrderedDict
...
methods.
2017-01-25 00:30:04 +02:00
Raymond Hettinger
a67619ec5f
merge
2016-12-31 12:02:42 -07:00
Raymond Hettinger
b46ea90343
Issue #29119 : Fix weakref in OrderedDict.move_to_end(). Work by Andra Bogildea.
2016-12-31 12:01:59 -07:00
Raymond Hettinger
0d5048cb21
Issue #17941 : Add a *module* parameter to collections.namedtuple()
2016-09-12 00:18:31 -07:00
Raymond Hettinger
dc65c68524
Remove main section that was only used during testing and development
2016-08-21 20:52:26 -07:00
Raymond Hettinger
8579a8fd63
Minor readability tweak
2016-08-17 00:46:48 -07:00
Raymond Hettinger
6538b430cf
Issue #25628 : Make namedtuple "rename" and "verbose" parameters keyword-only.
2016-08-16 10:55:43 -07:00
Martin Panter
e501a93c18
Issue #27125 : Merge typo fixes from 3.5
...
Also merge changes from Issue #27117 ; no actual code changes to 3.6.
2016-05-29 09:05:06 +00:00
Martin Panter
8d56c026a5
Issue #27125 : Fix various errors like “will [be] inherited”
2016-05-29 04:13:35 +00:00
Martin Panter
3e04d5b306
Issue #27076 : Merge spelling from 3.5
2016-05-26 06:03:19 +00:00
Martin Panter
46f50726a0
Issue #27076 : Doc, comment and tests spelling fixes
...
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Raymond Hettinger
62bc321819
Fix out-of-date comment
2016-02-25 00:25:45 -08:00
Raymond Hettinger
2831b383e9
merge
2015-11-23 21:04:53 -08:00
Raymond Hettinger
c3f7d1753f
Fix non-ascii character
2015-11-23 21:03:09 -08:00
Raymond Hettinger
a89013d930
merge
2015-11-23 20:43:56 -08:00
Raymond Hettinger
c9c3dd87c1
Add a missing docstring
2015-11-23 20:43:28 -08:00
Serhiy Storchaka
5527cf119d
Issue #22609 : Constructor of collections.UserDict now accepts the self keyword
...
argument.
2015-09-29 23:38:34 +03:00
Serhiy Storchaka
f4ee1c23e8
Issue #22609 : Constructor of collections.UserDict now accepts the self keyword
...
argument.
2015-09-29 23:37:09 +03:00
Serhiy Storchaka
68f5ef226e
Issue #22609 : Constructor of collections.UserDict now accepts the self keyword
...
argument.
2015-09-29 23:36:06 +03:00
Raymond Hettinger
3ada93fc86
merge
2015-09-08 00:36:56 -04:00
Raymond Hettinger
8ba03cf33f
Fix whitespace in comment.
2015-09-08 00:36:29 -04:00
Raymond Hettinger
9157545c11
merge
2015-08-30 09:15:36 -07:00
Raymond Hettinger
7a3602e7cf
Issue #24931 : Resolve __dict__ conflict in namedtuple subclasses.
2015-08-30 09:13:48 -07:00
Raymond Hettinger
4c97a62ae3
Issue #23509 : Speed up Counter operators
...
(Based on patch by Serhiy Storchaka.)
2015-05-29 22:14:07 -07:00
Eric Snow
96c6af9b20
Issue #16991 : Add a C implementation of collections.OrderedDict.
2015-05-29 22:21:39 -06:00
Raymond Hettinger
573b44c18f
Issue 22189: Add missing methods to UserString
2015-05-22 16:56:32 -07:00
Raymond Hettinger
32ea16577d
Issue 23704: Add index(), copy(), and insert() to deques. Register deques as a MutableSequence.
2015-03-21 01:37:37 -07:00
Serhiy Storchaka
08448a1f4d
Issue #23326 : Removed __ne__ implementations. Since fixing default __ne__
...
implementation in issue #21408 they are redundant.
2015-01-31 12:05:05 +02:00
Serhiy Storchaka
f51f713f30
Issue #22609 : Revert changes in UserDict. They conflicted with existing tests.
2014-11-27 17:46:15 +02:00
Serhiy Storchaka
a86700ae87
Issue #22609 : Revert changes in UserDict. They conflicted with existing tests.
2014-11-27 17:45:44 +02:00
Serhiy Storchaka
8943ecfab2
Issue #22609 : Constructors and update methods of mapping classes in the
...
collections module now accept the self keyword argument.
2014-11-27 16:35:26 +02:00
Serhiy Storchaka
ae5cb214d2
Issue #22609 : Constructors and update methods of mapping classes in the
...
collections module now accept the self keyword argument.
2014-11-27 16:25:51 +02:00
Raymond Hettinger
f2bbb651a8
merge
2014-06-24 15:21:24 -07:00
Raymond Hettinger
bc000509e8
Issue 21832: Require named tuple inputs to be exact strings
2014-06-24 15:20:55 -07:00
Raymond Hettinger
53d2c41f77
Issue #19414 : Have the OrderedDict mark deleted links as unusable.
...
This gives an earlier and more visible failure if a link is deleted
during iteration.
2014-05-03 21:58:45 -07:00
Serhiy Storchaka
578c9211d6
Issue #19505 : The items, keys, and values views of OrderedDict now support
...
reverse iteration using reversed().
2014-04-04 15:19:36 +03:00
Raymond Hettinger
d852e997f4
Clean-up docstring
2014-03-20 06:42:31 -07:00
Christian Heimes
5703cd58ca
whitespace cleanup
2013-10-13 02:27:22 +02:00
Christian Heimes
52c5e57dbc
Issue #19218 : Add facade collections.abc
2013-10-13 02:04:50 +02:00
Christian Heimes
f1dc3ee16d
Issue #19218 : Rename collections.abc to _collections_abc in order to speed up interpreter start
2013-10-13 02:04:20 +02:00
Nick Coghlan
45163ccce4
Close #18690 : register memoryview with Sequence ABC
2013-10-02 22:31:47 +10:00
Ezio Melotti
a7e7497d88
#18466 : merge with 3.3.
2013-08-17 16:58:13 +03:00
Ezio Melotti
85a8629d21
#18466 : fix more typos. Patch by Févry Thibault.
2013-08-17 16:57:41 +03:00
Guido van Rossum
840c310a25
Fix typo on MutableSequence docstring.
2013-07-25 11:55:41 -07:00
Brett Cannon
cd171c8e92
Issue #18200 : Back out usage of ModuleNotFoundError (8d28d44f3a9a)
2013-07-04 17:43:24 -04:00
Brett Cannon
0a140668fa
Issue #18200 : Update the stdlib (except tests) to use
...
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Raymond Hettinger
587d3bf78a
Update docstring for _asdict() to indicate it is obsolete.
...
Use the cleaner looking @property style for __dict__.
Move _replace() to be just after make() to indicate that
it is a core method on named tuples.
2013-05-17 16:43:14 -07:00
Raymond Hettinger
b37706f306
Remove unnecessary exception handler.
2013-05-17 02:28:33 -07:00
Serhiy Storchaka
3ee6dabf5b
Issue #17900 : Allowed pickling of recursive OrderedDicts. Decreased pickled
...
size and pickling time.
2013-05-21 12:47:57 +03:00
Raymond Hettinger
163e9821b4
Undo the deprecation of _asdict().
...
Backed out changeset c4ca39bece9d
2013-05-18 00:05:20 -07:00
Raymond Hettinger
4e0172fd9a
Deprecate nametuple._asdict()
2013-05-17 17:14:27 -07:00
Raymond Hettinger
8c03d832b3
merge
2013-05-17 16:43:58 -07:00
Raymond Hettinger
5c71079d06
merge
2013-05-17 02:29:27 -07:00
Richard Oudkerk
7a3dae056d
Issue #15528 : Add weakref.finalize to support finalization using
...
weakref callbacks.
This is 2e446e87ac5b except that collections/__init__.py has been
modified to import proxy from _weakref instead of weakref. This
eliminates an import cycle which seems to cause a problem on Unix but
not Windows.
2013-05-05 23:05:00 +01:00
Raymond Hettinger
4072875dcb
merge
2013-05-03 02:41:02 -07:00
Raymond Hettinger
b98dcc1f53
Issue #15535 : Fix pickling of named tuples.
2013-05-03 02:24:15 -07:00
Raymond Hettinger
bb25b6fc94
merge
2013-03-24 15:21:57 -07:00
Raymond Hettinger
153866ea9a
Add missing docstrings to the collections ABCs
2013-03-24 15:20:29 -07:00
Raymond Hettinger
325dc887ca
Backport improved dict comparison logic
2013-03-23 06:34:19 -07:00
Raymond Hettinger
a35e281200
Merge
2013-03-01 23:51:26 -08:00
Raymond Hettinger
4f4ba16677
Issue #17331 : Use isidentifier() instead of isalnum() to check for valid identifiers.
2013-03-01 23:43:48 -08:00
Vinay Sajip
1ba81ee19a
Closes #16613 : Added optional mapping argument to ChainMap.new_child.
2013-01-11 23:39:53 +00:00
Raymond Hettinger
527507d72e
Improve OrderedDict equality test.
2012-12-07 10:18:22 -08:00
Andrew Svetlov
73ee816d05
Merge issue #16373 : Prevent infinite recursion for ABC Set class operations.
...
Patch by Serhiy Storchaka.
2012-11-01 13:31:31 +02:00
Andrew Svetlov
b904e4256e
Merge issue #16373 : Prevent infinite recursion for ABC Set class operations.
...
Patch by Serhiy Storchaka.
2012-11-01 13:31:12 +02:00
Philip Jenvey
4993cc0a5b
utilize yield from
2012-10-01 12:53:43 -07:00
Raymond Hettinger
1c2018c311
Small cleanup and optimization
2012-06-09 22:51:39 -07:00
Raymond Hettinger
80ed4d4774
Minor reformatting (wrap fat lines, etc.) and create an __main__ file
2012-06-09 18:46:45 -07:00
Victor Stinner
7b17a4e117
Close #14386 : Register types.MappingProxyType as a Mapping
2012-04-20 01:41:36 +02:00
Raymond Hettinger
02184282c7
Clarify that the purpose of computing all the miscellaneous collection types is to register them with the appropriate ABCs.
2012-04-05 13:31:12 -07:00
Raymond Hettinger
4fd3f0c850
Merge
2012-01-26 00:15:07 -08:00
Raymond Hettinger
f1182cd4db
Merge
2011-11-05 13:39:57 -07:00
Raymond Hettinger
becd56822a
Issue #13121 : Support in-place math operators for collections.Counter().
2011-10-19 13:40:37 -07:00
Ezio Melotti
d8b509b192
#13012 : use splitlines(keepends=True/False) instead of splitlines(0/1).
2011-09-28 17:37:55 +03:00
Benjamin Peterson
c92f6226d7
add ChainMap to __all__ ( closes #12959 )
...
Thanks July Tikhonov.
2011-09-11 12:55:34 -04:00
Raymond Hettinger
fcb393c018
Add support for unary plus and unary minus to collections.Counter()
2011-08-09 13:00:40 -07:00
Raymond Hettinger
22cc1183a3
merge
2011-06-02 23:49:44 -07:00
Raymond Hettinger
1c7b7f7fbe
Userlist.copy() wasn't returning a UserList.
2011-05-05 14:34:35 -07:00
Raymond Hettinger
a82aa55b5e
Minor clean-ups to docstrings, comments, and var names.
2011-04-24 14:34:26 -07:00
Raymond Hettinger
4f438b7b00
Minor text rearrangement.
2011-04-20 13:09:46 -07:00
Raymond Hettinger
f48ac3001a
Issue #11875 : Alter the previous fix to work better with subclasses
2011-04-19 17:19:11 -07:00
Raymond Hettinger
98c850a398
Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object.
2011-04-19 11:04:44 -07:00
Raymond Hettinger
90375bc7c0
Rework multiset methods to use less memory and to make fewer calls to __hash__.
2011-04-17 19:49:29 -07:00
Raymond Hettinger
b5a40d4d3f
Fix minor subclassing issue with collections.Counter
2011-04-15 13:23:01 -07:00
Raymond Hettinger
f6d3e8eaef
Add tests for _source to importable and exec'able.
...
Move __name__ back out of the template; the responsibility
for setting __name__ lies with the caller (which knows
something about the new namespace), not with the class
definition (which doesn't know about the namespace it is
being built in).
2011-03-23 20:33:30 -07:00
Raymond Hettinger
15d0c1d073
Minor clean-ups.
2011-03-23 14:38:39 -07:00
Raymond Hettinger
2ebea41d31
Expose the namedtuple source with a _source attribute.
2011-03-23 12:52:23 -07:00
Raymond Hettinger
843a751369
Move namespace setup inside the template.
2011-03-23 11:49:56 -07:00