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.
...Definition. Holds Python's intellectual property rights for releases 2.1 and following. Seeks to obtain the intellectual property rights for Python releases prior to 2.1, for relicensing under the PSF Python license, to relieve the legal burden on Python's users. The PSF may also seek rights to other Python-related software for relicensing under a PSF license. Protects the Python name, and the names, service marks and trademarks associated with all other intellectual property held by the PSF. S...
PEP 754 -- IEEE 754 Floating Point Special Values PEP:754 Title:IEEE 754 Floating Point Special Values Author:Gregory R. Warnes <gregory_r_warnes at groton.pfizer.com> (Pfizer, Inc.) Status:Rejected Type:Standards Track Created:28-Mar-2003 Python-Version:2.3 Post-History: Contents Rejection Notice Abstract Rationale API Definition Constants Functions Example Implementation References Copyright Rejection Notice This PEP has been rejected. After sitting open for four ...
...Class-based Syntax A TypedDict type can be defined using the class definition syntax with typing.TypedDict as the sole base class: from typing import TypedDict class Movie(TypedDict): name: str year: int Movie is a TypedDict type with two items: 'name' (with type str) and 'year' (with type int). A type checker should validate that the body of a class-based TypedDict definition conforms to the following rules: The class body should only contain lines with item definitions of the form ...
PEP 442 -- Safe object finalization PEP:442 Title:Safe object finalization Author:Antoine Pitrou <solipsis at pitrou.net> BDFL-Delegate:Benjamin Peterson <benjamin at python.org> Status:Final Type:Standards Track Created:18-May-2013 Python-Version:3.4 Post-History:18-May-2013 Resolution:https://mail.python.org/pipermail/python-dev/2013-June/126746.html Contents Abstract Definitions Impact Benefits Description Reference-counted disposal Disposal of cyclic isolates...
...classic classes and for new-style classes rough benchmarking showed an actual slowdown thanks to having to support both classic and new-style classes. References [Aho86]Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools, http://www.amazon.com/exec/obidos/tg/detail/-/0201100886/104-0162389-6419108 [Wang97]Daniel C. Wang, Andrew W. Appel, Jeff L. Korn, and Chris S. Serra. The Zephyr Abstract Syntax Description Language. In Proceedings of the Confe...
...Definition list ends without a blank line; unexpected unindent. </ul> <li />These RPMs are built from the python.org .spec file: <ul> <li /><a href="/ftp/python/2.2.3/rpms/redhat-9/python2-2.2.3-1.i386.rpm">python2-2.2.3-1.i386.rpm</a> (Red Hat 9 base RPM, 6232077 bytes) <li /><a href="/ftp/python/2.2.3/rpms/redhat-9/python2-devel-2.2.3-1.i386.rpm">python2-devel-2.2.3-1.i386.rpm</a> (Red Hat 9 development RPM, 579465 byte...
...definition Legacy manylinux tags Package installers Package indexes Rejected alternatives Abstract This PEP proposes a scheme for new 'manylinux' wheel tags to be defined without requiring a PEP for every specific tag, similar to how Windows and macOS tags already work. This will allow package maintainers to take advantage of new tags more quickly, while making better use of limited volunteer time. Non-goals include: handling non-glibc-based platforms; integrating with external package mana...
...class objects Sometimes you want to talk about class objects, in particular class objects that inherit from a given class. This can be spelled as Type[C] where C is a class. To clarify: while C (when used as an annotation) refers to instances of class C, Type[C] refers to subclasses of C. (This is a similar distinction as between object and type.) For example, suppose we have the following classes: class User: ... # Abstract base for User classes class BasicUser(User): ... class ProUser(Use...
...class of the generated parser class: class MyXPath(XPath): ... UNION = pyxpath.UNION_OPERATOR ... def nop(self, operator, left, right): return self.factory.createNumericOperator(operator, left, right) This class can go into the grammar definition file. Like YACC, YAPPS supports custom code before and after the grammar definition. YAPPS parsers integrate with the scanner through a Scanner object, which is passed...
...classic classes and new-style classes</h3> <p>The following differences between classic and new-style classes may require attention when you are converting a classic class to a new-style class. Since previous versions of Python don't support new-style classes, these can't be considered to be real bugs, but since we've tried very hard to make the behavior of new-style classes backwards compatible, it's important to note these differences. (There are of course many more differences th...
...Definition list ends without a blank line; unexpected unindent. </ul> <p>David Abrahams was present and presented an application to the secretary at the meeting. <p>(Note that Charles Waldman is already a PSF member, a point that was overlooked at the meeting.) <p>Upon further discussion, several corporations were invited to be sponsor members of the Corporation. Upon motion by Guido van Rossum, seconded by Ka-Ping Yee, it was unanimously <p>RESOLVED, that the fol...
...definition, which can be summarized as "anything that's valid as string input to eval". This definition of "expression" is convenient in that it fits our needs well, and reuses the allowed grammar of existing language constructs. It has two subtle differences from the other definition: Tuple Displays Must Be Parenthesized This is based on an observation Guido made in the same email. Continued immediately from above: Though I wouldn't allow commas-- there's no way that @f, g def pooh(): ... ...
...Definition list ends without a blank line; unexpected unindent. </blockquote>
...class and isinstance. All type information in instances is erased at runtime. Examples: def count(seq: Sequence) -> int: # Same as Sequence[Any] ... class FrameworkBase(Generic[S, T]): ... class UserClass: ... issubclass(UserClass, FrameworkBase) # This is OK class Node(Generic[T]): ... IntNode = Node[int] my_node = IntNode() # at runtime my_node.__class__ is Node # inferred static type of my_node is Node[int] Covariance and Contravariance I...
...definitions must use full prototypes (i.e. specify the types of all arguments). No compiler warnings with major compilers (gcc, VC++, a few others). static inline functions should be preferred over macros in new code. Code lay-out Use 4-space indents and no tabs at all. No line should be longer than 79 characters. If this and the previous rule together don't give you enough room to code, your code is too complicated -- consider using subroutines. No line should end in whitespace. If you ...
...definition of element-wise comparison operations in NumPy to return a dedicated subclass that implements the new circuit breaking protocol and also changes the result array's interpretation in a boolean context to always return False and hence never trigger the short-circuiting behaviour: class ComparisonResultArray(np.ndarray): def __bool__(self): # Element-wise comparison chaining never short-circuits return False def _raise_NotImplementedError(self): msg = ("C...
...Class1. We now (manually) instantiate MetaClass1 once to get an empty special base class: BaseClass1 = MetaClass1("BaseClass1", (), {}) We can now use BaseClass1 as a base class in a class statement: class MySpecialClass(BaseClass1): i = 1 def f(s): pass At this point, MySpecialClass is defined; it is a metainstance of MetaClass1 just like BaseClass1, and in fact the expression ``BaseClass1.__class__ == MySpecialClass.__class__ == MetaClass1'' yields true. W...