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.
...interface should throw an exception in case the method is used. The preferred approach is to not implement the method and thus have Python generate an AttributeError in case the method is requested. This allows the programmer to check for database capabilities using the standard hasattr() function. For some dynamically configured interfaces it may not be appropriate to require dynamically making the method available. These interfaces should then raise a NotSupportedError to indicate the non-abil...
...interface can be reasonably low. Thus, simplicity of implementation on both the server and framework sides of the interface is absolutely critical to the utility of the WSGI interface, and is therefore the principal criterion for any design decisions. Note, however, that simplicity of implementation for a framework author is not the same thing as ease of use for a web application author. WSGI presents an absolutely "no frills" interface to the framework author, because bells and whistles like r...
...interfaces which will allow a variety of plug-in components (input context readers, markup parsers, and output format writers) to be used. The concepts of a DPS framework are presented independently of implementation details. Road Map to the Docstring PEPs There are many aspects to docstring processing. The "Docstring PEPs" have broken up the issues in order to deal with each of them in isolation, or as close as possible. The individual aspects and associated PEPs are as follows: Docstring ...
...Definition of Terms The definition of "MAY", "MUST", and "SHOULD", and "SHOULD NOT" are to be interpreted as described in RFC 2119. "inline" - the types are part of the runtime code using PEP 526 and PEP 3107 syntax (the filename ends in .py). "stubs" - files containing only type information, empty of runtime code (the filename ends in .pyi). "Distributions" are the packaged files which are used to publish and distribute a release. (PEP 426) "Module" a file containing Python runtime code or stub...
...interface, supporting reading and writing binary (but not character) data. Out of Scope Issues Python 3k will have a much different I/O subsystem. Deciding how that I/O subsystem will work and interact with the bytes object is out of the scope of this PEP. The expectation however is that binary I/O will read and write bytes, while text I/O will read strings. Since the bytes type supports the buffer interface, the existing binary I/O operations in Python 2.6 will support bytes objects. It h...
...interface to pass an additional PyObject for the keyword arguments. C interface As briefly introduced in the previous analysis, the C interface would potentially have to change to allow the new feature. Specifically, PyObject_GetItem and related routines would have to accept an additional PyObject *kw argument for Strategy "kwargs argument". The remaining strategies would not require a change in the C function signatures, but the different nature of the passed object would potentially requi...
...definitions for the benefit of redistributors that want to override those default settings. The locale coercion behaviour would be controlled by the flag --with[out]-c-locale-coercion, which would set the PY_COERCE_C_LOCALE preprocessor definition. The locale warning behaviour would be controlled by the flag --with[out]-c-locale-warning, which would set the PY_WARN_ON_C_LOCALE preprocessor definition. (Note: this compile time warning option ended up being replaced by a runtime PYTHONCOERCECLOCAL...
...definition in the nearest enclosing function scope will be used. One consequence of this change is that lambda statements could reference variables in the namespaces where the lambda is defined. In some unusual cases, this change will break code. In all previous version of Python, names were resolved in exactly three namespaces -- the local namespace, the global namespace, and the builtin namespace. According to this old definition, if a function A is defined within a function B, the names bo...
...Definitions Rationale Proposal API and Implementation Default arguments Naming conventions Alternatives Comparison To Other Languages What Should Be The Name Of The Module? Frequently Asked Questions References Copyright Abstract This PEP proposes the addition of a module for common security-related functions such as generating tokens to the Python standard library. Definitions Some common abbreviations used in this proposal: PRNG: Pseudo Random Number Generator. A deterministic algorit...
...definition is a required key: class Movie(TypedDict, total=False): title: Required[str] year: int Additionally the typing.NotRequired type qualifier is used to indicate that a variable declared in a TypedDict definition is a potentially-missing key: class Movie(TypedDict): # implicitly total=True title: str year: NotRequired[int] It is an error to use Required[] or NotRequired[] in any location that is not an item of a TypedDict. Type checkers must enforce this restriction. ...
...definitions of the concept of type in the literature. Here we assume that type is a set of values and a set of functions that one can apply to these values. There are several ways to define a particular type: By explicitly listing all values. E.g., True and False form the type bool. By specifying functions which can be used with variables of a type. E.g. all objects that have a __len__ method form the type Sized. Both [1, 2, 3] and 'abc' belong to this type, since one can call len on them: ...
...Interface PEP:444 Title:Python Web3 Interface Author:Chris McDonough <chrism at plope.com>, Armin Ronacher <armin.ronacher at active-4.com> Discussions-To:web-sig at python.org Status:Deferred Type:Informational Created:19-Jul-2010 Contents Abstract PEP Deferral Rationale and Goals Differences from WSGI Specification Overview The Application/Framework Side The Server/Gateway Side Middleware: Components that Play Both Sides Specification Details environ Variables I...
...definition of complete and safe. Even with bytecode verification, Python programs can and most likely in the future will seg-fault for a variety of reasons and continue to cause many different classes of run-time errors, fatal or not. The verification step proposed here simply plugs an easy hole that can cause a large class of fatal and subtle errors at the bytecode level. Currently, the Java Virtual Machine (JVM) verifies Java bytecode in a way very similar to what is proposed here. The JVM S...
...definition will rely only on those required attributes. This proposal takes a conservative approach in requiring only a small number of attributes. As more become appropriate, they may be added with discretion, as described in Adding New Required Attributes. While this PEP places no other constraints on sys.implementation, it also recommends that no one rely on capabilities outside those described here. The only exception to that recommendation is for attributes starting with an underscore. I...
...definition and C extension ABI, and the desire to get new features (most notably standard library updates) into user's hands more quickly. With the standard library release cycle decoupled (to some degree) from that of the core language definition, it provides an opportunity to actually slow down the rate of change in the language definition. The language moratorium for Python 3.2 effectively slowed that cycle down to more than 3 years (3.1: June 2009, 3.3: August 2012) without causing any major...
...definitions else: # Python 2 specific definitions if sys.platform == 'win32': # Windows specific definitions else: # Posix specific definitions Don't expect a checker to understand obfuscations like "".join(reversed(sys.platform)) == "xunil". Runtime or type checking? Sometimes there's code that must be seen by a type checker (or other static analysis tools) but should not be executed. For such situations the typing module defines a constant, TYPE_CHECKING, that is considered Tr...
...interface for modifications Setting and restoring context variables Alternative Designs for ContextVar API Logical Context with stacked values ContextVar "set/reset" Backwards Compatibility Rejected Ideas Replication of threading.local() interface Coroutines not leaking context changes by default Appendix: HAMT Performance Analysis Acknowledgments Version History References Copyright Abstract This PEP adds a new generic mechanism of ensuring consistent access to non-local state in the c...
...interface that can be hopefully accepted and implemented by existing image classes inside and outside the standard library without breaking backward compatibility with their existing user bases. In practice this is a definition of how a minimal image-like object should look and act (in a similar way to the read() and write() methods in file-like objects). The inclusion in the standard library of a class that provides basic image manipulation functionality and implements the new protocol is also...
...definition. Other classes don't have a natural ordering of their attributes so you're required to use explicit names in your pattern to match with their attributes. However, it's possible to manually specify the ordering of the attributes allowing positional matching, like in this alternative definition: class Click: __match_args__ = ("position", "button") def __init__(self, pos, btn): self.position = pos self.button = btn ... The __match_args__ special attribut...
...Interface eXtension, a powerful set of user interface components that expands the capabilities of your Tcl/Tk and Python applications. Build Bug #929689: Don't define _XOPEN_SOURCE on UnixWare 7.1.4. What's New in Python 2.3.3 (final)? Release date: 19-Dec-2003 Core and builtins Removed PendingDeprecationWarning from apply(). apply() remains deprecated, but the nuisance warning will not be issued. Library A couple of bugs were squished in trace.py What's New in Python 2.3.3c1...