
9. Classes — Python 3.13.3 documentation
3 days ago · Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have attributes attached to it for maintaining its state.
types --- 动态类型创建和内置类型名称 — Python 3.12.10 文档
Mar 12, 2010 · types.prepare_class(name, bases=(), kwds=None) ¶ 计算适当的元类并创建类命名空间。 参数是组成类定义头的部件:类名称,基类 (有序排列) 以及关键字参数 (例如 metaclass)。 返回值是一个 3 元组: metaclass, namespace, kwds
What’s New In Python 3.7 — Python 3.13.3 documentation
The new WrapperDescriptorType, MethodWrapperType, MethodDescriptorType, and ClassMethodDescriptorType classes are now available. (Contributed by Manuel Krebber and Guido van Rossum in bpo-29377, and Serhiy Storchaka in bpo-32265.)
enum — Support for enumerations — Python 3.10.17 …
Mar 10, 2017 · A new Enum class must have one base Enum class, up to one concrete data type, and as many object -based mixin classes as needed. The order of these base classes is:
3. Data model — Python 3.13.3 documentation
3 days ago · Called to create a new instance of class cls. __new__() is a static method (special-cased so you need not declare it as such) that takes the class of which an instance was requested as its first argument.
What’s New In Python 3.2
A new class, SSLContext, serves as a container for persistent SSL data, such as protocol settings, certificates, private keys, and various other options. It includes a wrap_socket() for creating an SSL socket from an SSL context.
8. Compound statements — Python 3.13.3 documentation
4 days ago · The class’s suite is then executed in a new execution frame (see Naming and binding), using a newly created local namespace and the original global namespace.
typing —— 对类型提示的支持 — Python 3.9.21 文档
At runtime, the statement Derived = NewType('Derived', Base) will make Derived a callable that immediately returns whatever parameter you pass it. That means the expression Derived(some_value) does not create a new class or introduce any overhead beyond that of a regular function call.
Python Documentation contents — Python 3.13.3 documentation
What’s New in Python- What’s New In Python 3.13- Summary – Release Highlights, New Features- A better interactive interpreter, Improved error messages, Free-threaded CPython, An experimental just-i...
dataclasses — Data Classes — Python 3.13.3 documentation
4 days ago · Creates a new dataclass with name cls_name, fields as defined in fields, base classes as given in bases, and initialized with a namespace as given in namespace. fields is an iterable whose elements are each either name, (name, type), or (name, type, Field).