About 12,600,000 results
Open links in new tab
  1. namedtuple vs NamedTuple in Python - Stack Overflow

    The type generated by subclassing typing.NamedTuple is equivalent to a collections.namedtuple, but with __annotations__, _field_types and _field_defaults attributes added. The generated code will …

  2. Newest 'python-collections' Questions - Stack Overflow

    May 23, 2025 · Python 3.9 includes PEP 585 and deprecates many of the types in the typing module in favor of the ones in collections.abc, now that they support __class_getitem__.

  3. python - collections.Iterable vs typing.Iterable in type annotation and ...

    Oct 16, 2018 · Due to PEP 585 - Type Hinting Generics In Standard Collections, Python's standard library container types are also able to accept a generic argument for type annotations. This includes …

  4. How to sort Counter by value? - python - Stack Overflow

    Other than doing list comprehensions of reversed list comprehension, is there a pythonic way to sort Counter by value? If so, it is faster than this: >>> from collections import Counter &...

  5. python - What is isinstance with a dictionary and abc.Mapping from ...

    Feb 29, 2016 · The collections.abc module provides several abstract base classes that can be used to generically describe the various kinds of data structures in Python. In your example, you test if an …

  6. python - Difference between collections.abc.Sequence and typing ...

    Jan 30, 2023 · In older versions of python, typing.Sequence is a generic version of collections.abc.Sequence, used for typing. In recent versions, both are generic and typing.Sequence …

  7. python - queue.Queue vs. collections.deque - Stack Overflow

    Python has at least two queue classes, queue.Queue and collections.deque, with the former seemingly using the latter internally. Both claim to be thread-safe in the documentation.

  8. iteration - Pythonic way to iterate over a collections.Counter ...

    In Python 2.7, I want to iterate over a collections.Counter instance in descending count order.

  9. python - cannot import name 'MutableMapping' from 'collections'

    Jan 26, 2022 · If you have this issue a simple method to patch the issue for 3.10 is to port back the library into collections instead of bothering about changing third party code, or your own code to be …

  10. python - cannot import name 'Sequence' from 'collections' - Stack …

    Jul 22, 2024 · The pathlib package is willing to import Sequence from collections instead of collections.abc; this is deprecared since Python 3.3, and not working anymore since Pyhton 3.10.