Commit Graph

154 Commits

Author SHA1 Message Date
Brandt Bucher
145bf269df bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Talin <viridia@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-02-26 14:51:55 -08:00
Raymond Hettinger
b6d68aa08b bpo-43102: Set namedtuple __new__'s internal builtins to a dict. (GH-24439) 2021-02-04 15:52:16 -08:00
Hugo van Kemenade
c47c78b878 bpo-37324: Remove ABC aliases from collections (GH-23754)
Remove deprecated aliases to Abstract Base Classes from the
collections module.
2021-01-13 00:16:37 +01:00
kj
463c7d3d14 bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and typing (GH-23060) 2020-12-13 10:38:24 -08:00
Andreas Poehlmann
0be9ce305f bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ (GH-23534) 2020-11-30 08:34:15 -08:00
Andre Delfino
e8a2076e14 Revert "Fix all Python Cookbook links (#22205)" (GH-22424)
This commit reverts commit ac0333e1e1 as the original links are working again and they provide extended features such as comments and alternative versions.
2020-09-27 01:47:25 +01:00
Andre Delfino
ac0333e1e1 Fix all Python Cookbook links (#22205) 2020-09-15 21:13:26 +01:00
Victor Stinner
7824cc05bf bpo-41006: collections imports lazily heap (GH-20940)
The collections module now imports lazily the heapq modules in the
Counter.most_common() method to speedup Python startup time.
2020-06-17 19:10:47 +02:00
Raymond Hettinger
31d17798d6 Collections module reformatting and minor code refactoring (GH-20772) 2020-06-10 23:17:58 -07:00
Raymond Hettinger
0a40849eb9 Minor improvement to the namedtuple implementation (GH-20741)
* Cleaner way to build the arg list with a trailing comma when required

* Fix appearance of __new__ in help()
2020-06-08 12:38:41 -07:00
Raymond Hettinger
3ff51d425e Deny eval() direct access to builtins (GH-20713) 2020-06-07 23:51:40 -07:00
Raymond Hettinger
0e96c419d7 Update comments to reflect the current API (GH-20682) 2020-06-06 12:42:54 -07:00
Raymond Hettinger
b7d79b4f36 bpo-40755: Add rich comparisons to Counter (GH-20548) 2020-05-31 14:57:42 -07:00
Raymond Hettinger
60398512c8 bpo-40755: Add missing multiset operations to Counter() (GH-20339) 2020-05-28 08:35:46 -07:00
Raymond Hettinger
3cfe5b7b8f Simplify creation of the __new__ method in namedtuple() (GH-20361) 2020-05-25 21:39:00 -07:00
Raymond Hettinger
4cc4d6048e Expand the implementation comments (GH-19699) 2020-04-24 02:33:07 -07:00
sweeneyde
a81849b031 bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)
Added str.removeprefix and str.removesuffix methods and corresponding
bytes, bytearray, and collections.UserString methods to remove affixes
from a string if present. See PEP 616 for a full description.
2020-04-22 23:05:48 +02:00
Curtis Bucher
f393b2c588 bpo-36144: Add PEP 584 operators to collections.ChainMap (#18832)
* Update ChainMap to include | and |=

Created __ior__, __or__ and __ror__ methods in ChainMap class.

* Update ACKS

* Update docs

* Update test_collections.py to include test_issue584().

Added testing for | and |= operators for ChainMap objects.

* Update test_union_operators

Renamed test_union operators, fixed errors and style problems raised by brandtbucher.

* Update test_union_operators in TestChainMap

Added testing for union operator between ChainMap and iterable of key-value pairs.

* Update test_union operators in test_collections.py

Gave more descriptive variable names and eliminated unnecessary tmp variable.

* Update test_union_operators in test_collections.py

Added cm3

* Check .maps rather than Chainmap equality.

* Add news entry

* Update Lib/test/test_collections.py

Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>

* Removed whitespace

* Added Guido's changes

* Fixed Docs

* Removed whitespace

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2020-03-23 12:02:05 -07:00
Brandt Bucher
6d674a1bf4 bpo-36144: OrderedDict Union (PEP 584) (#18967) 2020-03-13 09:06:04 -07:00
Brandt Bucher
eb8ac57af2 bpo-36144: Dictionary Union (PEP 584) (#12088) 2020-02-24 19:47:34 -08:00
Victor Stinner
af5ee3ff61 bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596)" (GH-18545)
This reverts commit ef092fe990.

Update collections __getattr__() and documentation to defer aliases
removal to Python 3.10.
2020-02-18 16:28:53 +01:00
Raymond Hettinger
58ccd201fa bpo-36321: Fix misspelled attribute name in namedtuple() (GH-16858) 2019-10-20 10:19:47 -07:00
Serhiy Storchaka
ef092fe990 bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596) 2019-10-07 12:10:15 +03:00
Daniel Fortunov
2a16eea71f bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138) 2019-08-27 21:38:09 -07:00
Florian Bruhin
c4106af38b Add missing space to warning message (GH-14915)
This typo was introduced in GH-13409 when changing the message text.
2019-08-21 23:06:51 -07:00