|
|
Subscribe / Log in / New account

Wrangling the typing PEPs

Wrangling the typing PEPs

Posted Dec 16, 2021 22:48 UTC (Thu) by NYKevin (subscriber, #129325)
In reply to: Wrangling the typing PEPs by mb
Parent article: Wrangling the typing PEPs

List absolutely does not mean "object with list protocol." That's spelled collections.abc.MutableSequence (see this table: https://docs.python.org/3/library/collections.abc.html#co...). As of Python 3.9, typing.List is just a deprecated alias for list. Previously, it was "a list that can have type parameters," but now that functionality has been moved into the builtin.

(Strictly speaking, it is possible to create an object with the mutable sequence protocol which is not a subclass of MutableSequence, but this is significantly more work and there's no obvious benefit to doing so, so I would like to believe that nobody would do it.)


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds