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.
PEP 3152 -- Cofunctions PEP:3152 Title:Cofunctions Author:Gregory Ewing <greg.ewing at canterbury.ac.nz> Status:Rejected Type:Standards Track Created:13-Feb-2009 Python-Version:3.3 Post-History: Contents Abstract Rejection Specification Cofunction definitions Cocalls New builtins, attributes and C API functions Motivation and Rationale Prototype Implementation Copyright Abstract A syntax is proposed for defining and calling a special type of generator called a 'co...
...definitions only allow simple function names to be used, even though functions are assignable first class objects. This PEP proposes adding support for assigning a function to a class or instance attribute directly in the function definition's header by using the dot notation to separate the object from the function's name. Although a similar feature, this PEP does not address general assignment to anything that supports assignment, such as dict keys and list indexes. Rationale Currently if a ...
...definition namespace. After the execution completes, the definition namespace is copied into a new dict. Then the original definition namespace is discarded. The new copy is stored away as the class's namespace and is exposed as __dict__ through a read-only proxy. The class attribute definition order is represented by the insertion order of names in the definition namespace. Thus, we can have access to the definition order by switching the definition namespace to an ordered mapping, such as c...
...definition, a function definition or as first string literal in a module. The string literals are added to the objects in question under the __doc__ attribute and are from then on available for introspection tools which can extract the contained information for help, debugging and documentation purposes. Docstrings appearing in locations other than the ones mentioned are simply ignored and don't result in any code generation. Here is an example: class C: "class C doc-string" a = 1 ...
...definition How can an inexperienced user validate a definition like os.stat? Simply by changing os.stat to os_stat, defining missing converters and pasting the definition into the Python interactive interpreter! In fact, a converters.py module could be auto-generated from converters.h. Reference implementation A reference implementation is available at issue 16612. Since this PEP was written under time constraints and the author is unfamiliar with the PLY toolchain, the software is written in ...
...definitions, a script to convert C source code containing type definitions will be provided [3]. References [1](1, 2) "python3 module definition file": http://svn.python.org/projects/python/branches/pep-0384/PC/python3.def [2]"PEP 384 branch": http://svn.python.org/projects/python/branches/pep-0384/ [3]"ABI type conversion script": http://svn.python.org/projects/python/branches/pep-0384/Tools/scripts/abitype.py Copyright This document has been placed in the public domain. So...
...definition will affect the containing scope. The name used in the trailing function or class definition is only visible from the associated @in clause, and behaves as if it was an ordinary variable defined in that scope. If any nested scopes are created in either the @in clause or the trailing function or class definition, those scopes will see the trailing function or class definition rather than any other bindings for that name in the containing scope. In a very real sense, this proposal is ab...
...definition, the name bindings that occur in the class block are not visible to enclosed functions.) A class definition is an executable statement that may contain uses and definitions of names. These references follow the normal rules for name resolution. The namespace of the class definition becomes the attribute dictionary of the class. The following operations are name binding operations. If they occur within a block, they introduce new local names in the current block unless there is also...
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 ...
...Definition lists are written like this: what Definition lists associate a term with a definition. how The term is a one-line phrase, and the definition is one or more paragraphs or body elements, indented relative to the term. Tables Simple tables are easy and compact: ===== ===== ======= A B A and B ===== ===== ======= False False False True False False False True False True True True ===== ===== ======= There must be at least two columns in a ...
...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(): ... ...
PEP 160 -- Python 1.6 Release Schedule PEP:160 Title:Python 1.6 Release Schedule Author:Fred L. Drake, Jr. <fred at fdrake.net> Status:Final Type:Informational Created:25-Jul-2000 Python-Version:1.6 Post-History: Contents Introduction Schedule Features Mechanism Copyright Introduction This PEP describes the Python 1.6 release schedule. The CVS revision history of this file contains the definitive historical record. This release will be produced by BeOpen PythonLabs s...
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...
...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 chained comparisons, where the comparison chaining will be updated to use the left-associative circuit breaking operator (else) rather than the logical disjunction operator (and) if the left hand comparison returns a circuit breaker as its result. While there are some practical complexities arising from the current handling of single-valued arrays in NumPy, this change should be sufficient to allow elementwise chained comparison operations for matrices, where the result is a matri...
...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 ...
...definition is a literal string, that string is assigned to the __doc__ attribute. The __doc__ attribute is called a documentation string, or docstring. It is often used to summarize the interface of the module, class or function. However, since there is no common format for documentation string, tools for extracting docstrings and transforming those into documentation in a standard format (e.g., DocBook) have not sprang up in abundance, and those that do exist are for the most part unmaintained ...
...definition is combined in a struct PyModuleDef: struct PyModuleDef{ PyModuleDef_Base m_base; /* To be filled out by the interpreter */ Py_ssize_t m_size; /* Size of per-module data */ PyMethodDef *m_methods; inquiry m_reload; traverseproc m_traverse; inquiry m_clear; freefunc m_free; }; Creation of a module is changed to expect an optional PyModuleDef*. The module state will be null-initialized. Each module method will be passed the module object as the first parameter. To acces...
...definition below platform_version: platform.version() implementation_version: see definition below The python_full_version and implementation_version marker variables are derived from sys.version_info and sys.implementation.version respectively, in accordance with the following algorithm: def format_full_version(info): version = '{0.major}.{0.minor}.{0.micro}'.format(info) kind = info.releaselevel if kind != 'final': version += kind[0] + str(info.serial) return version ...
...Definition list ends without a blank line; unexpected unindent. </form> <H3>Other Python search engines</H3> <UL> <p><li>The <a href="http://bugs.python.org/issue?@template=search&status=1">Python Bug Tracker</a> has a search form. </UL> <a name="hints"><H3>Where to search?</H3></a> <UL> <LI>If you're looking for a particular module or a module to do a particular thing, use the &...