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.
...Add a string argument to specify the return type Add a global flag to change the timestamp type Add a protocol to create a timestamp Add new fields to os.stat Add a boolean argument Add new functions Add a new hires module Links Copyright Rejection Notice This PEP is rejected. See https://mail.python.org/pipermail/python-dev/2012-February/116837.html. Abstract Decimal becomes the official type for high-resolution timestamps to make Python support new functions using a nanosecond resolutio...
...Add _io.WindowsConsoleIO Add _PyOS_WindowsConsoleReadline Add legacy mode Alternative Approaches Code that may break Assuming stdin/stdout encoding Incorrectly using the raw object Using the raw object with small buffers Copyright References Abstract Historically, Python uses the ANSI APIs for interacting with the Windows operating system, often via C Runtime functions. However, these have been long discouraged in favor of the UTF-16 APIs. Within the operating system, all text is represen...
...adds key_time and value_time fields to dictionary entries. It uses a global process-wide counter for dictionaries, incremented each time that a dictionary is modified. The times are used to decide when child objects first appeared in their parent objects. Discussion Thread on the mailing lists: python-dev: Updated PEP 509 python-dev: RFC: PEP 509: Add a private version to dict python-dev: PEP 509: Add a private version to dict (January 2016) python-ideas: RFC: PEP: Add dict.__version__ (Janu...
...address. Be sure to follow the format carefully: your name must appear first, and it must not be contained in parentheses. Your email address may appear second (or it can be omitted) and if it appears, it must appear in angle brackets. It is okay to obfuscate your email address. - If there is a mailing list for discussion of your new feature, add a Discussions-To header right after the Author header. You should not add a Discussions-To header if the ma...
...Add a PyFuncGuardObject object and a PyFuncGuard_Type type Add a PySpecializedCode structure Add the following fields to the PyFunctionObject structure: Py_ssize_t nb_specialized; PySpecializedCode *specialized; Add function methods: PyFunction_Specialize() PyFunction_GetSpecializedCodes() PyFunction_GetSpecializedCode() PyFunction_RemoveSpecialized() PyFunction_RemoveAllSpecialized() None of these function and types are exposed at the Python level. All these additions are explicitly ex...
...adding = 2; size_t arena_padding = 10; void* my_malloc(void *ctx, size_t size) { int padding = *(int *)ctx; return malloc(size + padding); } void* my_realloc(void *ctx, void *ptr, size_t new_size) { int padding = *(int *)ctx; return realloc(ptr, new_size + padding); } void my_free(void *ctx, void *ptr) { free(ptr); } void* my_alloc_arena(void *ctx, size_t size) { int padding = *(int *)ctx; return malloc(size + padding); } void my_free_arena(void *ctx, void *ptr, ...
...Add a new os.getrandom() function Examples using os.getrandom() Best-effort RNG wait_for_system_rng() Create a best-effort RNG Alternative Leave os.urandom() unchanged, add os.getrandom() Raise BlockingIOError in os.urandom() Proposition Criticism Add an optional block parameter to os.urandom() Acceptance Annexes Operating system random functions Why using os.urandom()? Copyright Abstract Modify os.urandom() to block on Linux 3.17 and newer until the OS urandom is initialized to inc...
...Add itertools.zip_strict Precedent Usability Maintenance Cost Add Several "Modes" To Switch Between Add A Method Or Alternate Constructor To The zip Type Change The Default Behavior Of zip Accept A Callback To Handle Remaining Items Raise An AssertionError Add A Similar Feature to map Do Nothing References Examples Copyright Abstract This PEP proposes adding an optional strict boolean keyword parameter to the built-in zip. When enabled, a ValueError is raised if one of the arguments is...
...Add a helper function contextlib.add_exc_note() It was suggested that we add a utility such as the one below to the standard library. We are open to this idea, but do not see it as a core part of the proposal of this PEP as it can be added as an enhancement later. @contextlib.contextmanager def add_exc_note(note: str): try: yield except Exception as err: err.add_note(note) raise with add_exc_note(f"While attempting to frobnicate {item=}"): frobnicate_or_rais...
...Add a new built-in function, ascii(). This function converts any python object to a string using repr() and then hex-escapes all non-ASCII characters. ascii() generates the same string as repr() in Python 2. Add a '%a' string format operator. '%a' converts any python object to a string using repr() and then hex-escapes all non-ASCII characters. The '%a' format operator generates the same string as '%r' in Python 2. Also, add '!a' conversion flags to the string.format() method and add '%A' o...
...address right away, add it to PEP 42 or ask the owner to add it for you. If you add the bug to PEP 42, mark the bug as "feature request", "later", and "closed"; and add a comment to the bug saying that this is the case (mentioning the PEP explicitly). XXX do we prefer the tracker or PEP 42? Assign the bug a reasonable priority. We don't yet have a clear sense of what each priority should mean. One rule, however, is that bugs with priority "urgent" or higher must be fixed before the next r...
...Add three new convenience functions for module initialization -- PyModule_AddObject(), PyModule_AddIntConstant(), and PyModule_AddStringConstant(). Cleaned up definition of NULL in C source code; all definitions were removed and add #error to Python.h if NULL isn't defined after #include of stdio.h. Py_PROTO() macros that were removed in 2.0b1 have been restored for backwards compatibility (at the source level) with old extensions. A wrapper API was added for signal() and...
...add any new code transformer. Using a code transformer will require an external module and to register it manually. See also PyXfuscator: Python obfuscator, deobfuscator, and user-assisted decompiler. Usage 3: Disable all optimization Ned Batchelder asked to add an option to disable the peephole optimizer because it makes code coverage more difficult to implement. See the discussion on the python-ideas mailing list: Disable all peephole optimizations. This PEP adds a new -o noopt command line ...
...adds a non-reserved keyword, the other adds two built-in functions. A third solution adds methods to sequence objects. Non-reserved keyword indexing This solution would extend the syntax of the for-loop by adding an optional <variable> indexing clause which can also be used instead of the <variable> in clause. Looping over the indices of a sequence would thus become: for i indexing sequence: # work with index i Looping over both indices and elements would similarly be: for i...
...added to the release (e.g. the web-based installers or redistributable zip files added to Python 3.5) someone will need to update add-to-pydotorg.py so it recognizes these new files. (It's best to update add-to-pydotorg.py when file types are removed, too.) In case the CDN already cached a version of the Downloads page without the files present, you can invalidate the cache using: $ curl -X PURGE https://www.python.org/downloads/release/python-XXX/ If this is a final release: Add the new ve...
...Adding a Built-In Set Object Type PEP:218 Title:Adding a Built-In Set Object Type Author:gvwilson at ddj.com (Greg Wilson), python at rcn.com (Raymond Hettinger) Status:Final Type:Standards Track Created:31-Jul-2000 Python-Version:2.2 Post-History: Contents Introduction Rationale Proposal Set Notation History Mutability Copyright Introduction This PEP proposes adding a Set module to the standard Python library, and to then make sets a built-in Python type if that module is ...
...add the ability to do everything in that checklist to Python's "httplib" module. Additional API sugar could also be added, probably in a new module. HTML and XML parsing are pretty solid, but a critical lack on the client side is the lack of a CSS parser. On the server side, things are a bit more dire. The stdlib contains three web server modules, BaseHTTPServer, SimpleHTTPServer, and CGIHTTPServer, none of which are up to today's web tasks. I'd suggest a similar strategy here: pic...
...Add sys.getfilesystemencodeerrors Update path_converter Remove unused ANSI code Add legacy mode Undeprecate bytes paths on Windows Beta experiment Affected Modules Rejected Alternatives Use strict mbcs decoding Make bytes paths an error on Windows Make bytes paths an error on all platforms Code that may break Not managing encodings across boundaries Explicitly using 'mbcs' References Copyright Abstract Historically, Python uses the ANSI APIs for interacting with the Windows operating sy...
...Add License-Expression field Add License-File field Deprecate License field Deprecate license classifiers Project source metadata Add license-expression key Add license-files key Deprecate license key License files in project formats Converting legacy metadata Mapping license classifiers to SPDX identifiers Backwards Compatibility Security Implications How to Teach This Reference Implementation Rejected Ideas Core metadata fields Re-use the License field Re-Use the License field with a v...
...add = UFunc('add', 3, 2, 'doc-string') When defined the add instance has no C functions associated with it and therefore can do no work. The CFunc dictionary is populated or registered later when the C-extension module for an array-type is imported. The arguments of the register method are: function name, function descriptor, and the CUFunc object. The corresponding Python code is add.register('add', (Int32, Int32, Int32), cfunc-add) In the initialization function of an array type module, ...