Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...declaration of "static" type objects is not possible anymore (for applications using this ABI). Instead, type objects get created dynamically. To allow an easy creation of types (in particular, to be able to fill out function pointers easily), the following structures and functions are available: typedef struct{ int slot; /* slot id, see below */ void *pfunc; /* function pointer */ } PyType_Slot; typedef struct{ const char* name; int basicsize; int itemsize; unsigned int flags; ...
...declaration syntax, the make statement. The proposed syntax and semantics parallel the syntax for class definition, and so: make <callable> <name> <tuple>: <block> is translated into the assignment: <name> = <callable>("<name>", <tuple>, <namespace>) where <namespace> is the dict created by executing <block>. This is mostly syntactic sugar for: class <name> <tuple>: __metaclass__ = <callable> &l...
...declaration within parentheses. The distutils project names should correspond to names as found on the Python Package Index. Version declarations must follow the rules described in Version Specifiers Examples: Requires-Dist: pkginfo Requires-Dist: PasteDeploy Requires-Dist: zope.interface (>3.5.0) Provides-Dist (multiple use) Each entry contains a string naming a Distutils project which is contained within this distribution. This field must include the project identified in the Name fiel...
...declarations of the following form: class x: def __attr_XXX__(self, op, val ): if op=="get": return someComputedValue(self.internal) elif op=="set": self.internal=someComputedValue(val) elif op=="del": del self.internal Client code looks like this: fooval=x.foo x.foo=fooval+5 del x.foo Semantics Attribute references of all three kinds should call the method. The op parameter can be "get"/"set"/"del". Of course this string will...
...declaration that Derived[Manager] is a subtype of Derived[Employee], and Derived[t1] is a subtype of Base[t1]. If we denote the is-subtype-of relationship with <, then the full diagram of subtyping for this case will be: Base[Manager] > Base[Employee] v v Derived[Manager] < Derived[Employee] so that a type checker will also find that, e.g., Derived[Manager] is a subtype of Base[Employee]. For more information on type variables, generic types, and variance, s...
...Declaration A parameter specification variable is defined in a similar manner to how a normal type variable is defined with typing.TypeVar. from typing import ParamSpec P = ParamSpec("P") # Accepted P = ParamSpec("WrongName") # Rejected because P =/= WrongName The runtime should accept bounds and covariant and contravariant arguments in the declaration just as typing.TypeVar does, but for now we will defer the standardization of the semantics of those options to a later PEP. Valid us...
PEP 655 -- Marking individual TypedDict items as required or potentially-missing PEP:655 Title:Marking individual TypedDict items as required or potentially-missing Author:David Foster <david at dafoster.net> Sponsor:Guido van Rossum <guido at python.org> Discussions-To:https://mail.python.org/archives/list/typing-sig@python.org/thread/53XVOD5ZUKJ263MWA6AUPEA6J7LBBLNV/ Status:Draft Type:Standards Track Created:30-Jan-2021 Python-Version:3.11 Post-History:31-Jan-2021, 1...
...declaration format defined in PEP 508, with the exception that environment markers MUST NOT be included in the individual dependency declarations, and are instead supplied in the separate environment field. requires is the only required subfield. When it is the only subfield, the dependencies are said to be unconditional. If extra or environment is specified, then the dependencies are conditional. All three fields may be supplied, indicating that the dependencies are needed only when the named e...
PEP 3123 -- Making PyObject_HEAD conform to standard C PEP:3123 Title:Making PyObject_HEAD conform to standard C Author:Martin von Löwis <martin at v.loewis.de> Status:Final Type:Standards Track Created:27-Apr-2007 Python-Version:3.0 Post-History: Contents Abstract Rationale Specification Compatibility with Python 2.6 Copyright Abstract Python currently relies on undefined C behavior, with its usage of PyObject_HEAD. This PEP proposes to change that into standard C. ...
...declaration, specifying the metaclass to be used to create the new class a class statement can contain a __slots__ declaration, specifying the specific names of the instance variables supported This PEP builds on PEP 252, which adds standard introspection to types; for example, when a particular type object initializes the tp_hash slot, that type object has a __hash__ method when introspected. PEP 252 also adds a dictionary to type objects which contains all methods. At the Python level, this...
...declaration does not guarantee that bugfix releases will be made on a regular basis, but it should enable volunteers who want to contribute bugfixes for Python 2.7 and it should satisfy vendors who still have to support Python 2 for years to come. There will be no Python 2.8 (see PEP 404). Release Manager and Crew Position Name 2.7 Release Manager Benjamin Peterson Windows installers Steve Dower Mac installers Ned Deily Maintenance releases Being the last of the 2.x series, 2.7...
...declaration of "keyword-only" arguments: arguments that can only be supplied by keyword and which will never be automatically filled in by a positional argument. Rationale The current Python function-calling paradigm allows arguments to be specified either by position or by keyword. An argument can be filled in either explicitly by name, or implicitly by position. There are often cases where it is desirable for a function to take a variable number of arguments. The Python language supports t...
PEP 244 -- The directive statement PEP:244 Title:The directive statement Author:martin at v.loewis.de (Martin von Löwis) Status:Rejected Type:Standards Track Created:20-Mar-2001 Python-Version:2.1 Post-History: Contents Motivation Syntax Semantics Specific Directives: transitional Backwards Compatibility Unresolved Problems: directive as the first identifier Questions and Answers Copyright Motivation From time to time, Python makes an incompatible change to the advertised ...
...Template(Protocol): name: str # This is a protocol member value: int = 0 # This one too (with default) def method(self) -> None: self.temp: List[int] = [] # Error in type checker class Concrete: def __init__(self, name: str, value: int) -> None: self.name = name self.value = value def method(self) -> None: return var: Template = Concrete('value', 42) # OK To distinguish between protocol class variables and protocol insta...
...template for reports. 10 Adjournment Van Lindberg adjourned the meeting at 18:28 CEST/ 12:28 EDT.
PEP 459 -- Standard Metadata Extensions for Python Software Packages PEP:459 Title:Standard Metadata Extensions for Python Software Packages Author:Nick Coghlan <ncoghlan at gmail.com> BDFL-Delegate:Nick Coghlan <ncoghlan at gmail.com> Discussions-To:distutils-sig at python.org Status:Withdrawn Type:Standards Track Requires:426 Created:11-Nov-2013 Post-History:21-Dec-2013 Contents PEP Withdrawal Abstract Standard Extension Namespace The python.details extension L...
PEP 3109 -- Raising Exceptions in Python 3000 PEP:3109 Title:Raising Exceptions in Python 3000 Author:Collin Winter <collinwinter at google.com> Status:Final Type:Standards Track Created:19-Jan-2006 Python-Version:3.0 Post-History: Contents Abstract Rationale Grammar Changes Changes to Builtin Types Semantic Changes Compatibility Issues Implementation References Copyright Abstract This PEP introduces changes to Python's mechanisms for raising exceptions intended to re...
PEP 387 -- Backwards Compatibility Policy PEP:387 Title:Backwards Compatibility Policy Author:Benjamin Peterson <benjamin at python.org> BDFL-Delegate:Brett Cannon (on behalf of the steering council) Discussions-To:https://discuss.python.org/t/pep-387-backwards-compatibilty-policy/ Status:Active Type:Process Created:18-Jun-2009 Post-History:19-Jun-2009, 12-Jun-2020 Contents Abstract Rationale Backwards Compatibility Rules Basic policy for backwards compatibility Makin...
...declaration syntax, including environment markers. As a result, this PEP ended up being rejected in favour of the more comprehensive PEP 508. Abstract An environment marker describes a condition about the current execution environment. They are used to indicate when certain dependencies are only required in particular environments, and to indicate supported platforms for distributions with additional constraints beyond the availability of a Python runtime. Environment markers were first specif...
...Template: __slots__ = ("raw_template", "parsed_template", "field_values", "format_specifiers") def __new__(cls, raw_template, parsed_template, field_values, format_specifiers): self = super().__new__(cls) self.raw_template = raw_template self.parsed_template = parsed_template self.field_values = field_values self.format_specifiers = format_specifiers return self def __repr__(self): return ...