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.
...Python bug 30071, Duck-typing inspect.isfunction() (https://bugs.python.org/issue30071) [3]Python bug 33261, inspect.isgeneratorfunction fails on hand-created methods (https://bugs.python.org/issue33261 and https://github.com/python/cpython/pull/6448) [4]Python bug 33265, contextlib.ExitStack abuses __self__ (https://bugs.python.org/issue33265 and https://github.com/python/cpython/pull/6456) [5]PyMethodDef documentation (https://docs.python.org/3.7/c-api/structures.html#c.PyMethod...
...functions makes Python 1.04x slower when the compiler does not inline static inline functions. Post History python-dev mailing list threads: Version 2 of PEP 670 - Convert macros to functions in the Python C API (February 2022) Steering Council reply to PEP 670 -- Convert macros to functions in the Python C API (February 2022) PEP 670: Convert macros to functions in the Python C API (October 2021) References bpo-45490: [C API] PEP 670: Convert macros to functions in the Python C API (Oct...
...functions' namespaces. The most visible consequence of this change is that lambdas (and other nested functions) can reference variables defined in the surrounding namespace. Currently, lambdas must often use default arguments to explicitly creating bindings in the lambda's namespace. Introduction This proposal changes the rules for resolving free variables in Python functions. The new name resolution semantics will take effect with Python 2.2. These semantics will also be available in Pytho...
...functions to the Python C API to specialize pure Python functions: add specialized codes with guards. It allows to implement static optimizers respecting the Python semantics. Rationale Python semantics Python is hard to optimize because almost everything is mutable: builtin functions, function code, global variables, local variables, ... can be modified at runtime. Implement optimizations respecting the Python semantics requires to detect when "something changes", we will call these checks "...
...Python-Version:2.5 Post-History:10-Feb-2003, 27-Feb-2003, 22-Feb-2004, 28-Apr-2006 Contents Note Abstract Acceptance Motivation Example Implementation Examples of Use Abandoned Syntax Proposal Feedback from comp.lang.python and python-dev Summary References Copyright Note Following the acceptance of this PEP, further discussion on python-dev and comp.lang.python revealed a desire for several tools that operated on function objects, but were not related to functional programming. Rathe...
...Python-C API, so I expected at most modest speed up compared to f7(). Given the effort of writing and testing an extension (compared to whipping up those Python one-liners), as well as the dependency on a non-standard Python extension, I decided not to pursue this option... Conclusion If you feel the need for speed, go for built-in functions - you can't beat a loop written in C. Check the library manual for a built-in function that does what you want. If there isn't one, h...
...Python version and must be recompiled at each Python version. STATUS: Completed (in Python 3.8) The reorganization of header files started in Python 3.7 and was completed in Python 3.8: bpo-35134: Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details. bpo-35081: Move internal headers to Include/internal/ Move private functions to the internal C API Private functions which expose implementation details must be moved to the internal C API. If a C extension r...
...functions in the implementation of CPython. Rationale and Goals The primary implementation of Python, "CPython", is written in a mixture of Python and C. One implementation detail of CPython is what are called "built-in" functions -- functions available to Python programs but written in C. When a Python program calls a built-in function and passes in arguments, those arguments must be translated from Python values into C values. This process is called "parsing arguments". As of CPython 3.3,...
...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. Source: https://github.com/python/peps/blob/master/pep-0384.txt
...python.org/pipermail/python-3000/2006-May/002091.html [6]https://mail.python.org/pipermail/python-3000/2006-May/001972.html [7]https://mail.python.org/pipermail/python-3000/2006-May/002105.html [8]https://mail.python.org/pipermail/python-3000/2006-May/002209.html [9]https://mail.python.org/pipermail/python-3000/2006-June/002438.html [10]http://svn.python.org/view?rev=53170&view=rev [11]http://docs.python.org/reference/compound_stmts.html#function-definitions ...
...Python annotations back into strings at compile time, requiring users of annotations to eval() those strings to restore them to their actual Python values. This has several drawbacks: It requires Python implementations to stringize their annotations. This is surprising behavior—unprecedented for a language-level feature. Also, adding this feature to CPython was complicated, and this complicated code would need to be reimplemented independently by every other Python implementation. It require...
...Python functions and be efficient as Python or built-in functions. Changes to existing C structs The function, method_descriptor and method classes will have their corresponding structs changed to start with the PyExtendedCallable struct. Third-party built-in classes using the new extended call interface To enable call performance on a par with Python functions and built-in functions, third-party callables should set the Py_TPFLAGS_EXTENDED_CALL bit of tp_flags and ensure that the correspon...
...python.org> Status:Final Type:Standards Track Created:02-Dec-2000 Python-Version:2.1 Post-History:20-Feb-2001 Contents Introduction Background Proposal Examples Other Uses Future Directions Dissenting Opinion Reference Implementation References Copyright Introduction This PEP describes an extension to Python, adding attribute dictionaries to functions and methods. This PEP tracks the status and ownership of this feature. It contains a description of the feature and outlines ...
...Python bytecode). The difficulty of analysing bytecode not withstanding, there is another issue with the dependency on using Python bytecode. IronPython [3] does not use Python's bytecode. Because it is based on the .NET framework it instead stores MSIL [4] in func_code.co_code attribute of the function. This fact prevents the inspect.getargspec function from working when run under IronPython. It is unknown whether other Python implementations are affected but is reasonable to assume if the i...
...Python for wrapped C++ functions. Generic C++ to Python Object Interface It is often necessary for C++ functions to manipulate objects passed to them directly from Python, without converting them to some other representation. Currently Boost.Python has undocumented support for that usage when the expected Python type is known. Goal: Addition of a C++ type which wraps any Python object and provides a similar interface to Python's, with the validity of any operat...
...python-ideas, March 2012: https://mail.python.org/pipermail/python-ideas/2012-March/014364.html and https://mail.python.org/pipermail/python-ideas/2012-March/014378.html and https://mail.python.org/pipermail/python-ideas/2012-March/014417.html [9](1, 2) https://mail.python.org/pipermail/python-ideas/2017-February/044888.html [10]https://github.com/pablogsal/cpython_positional_only [11]https://mail.python.org/pipermail/python-ideas/2016-January/037874.html [12]https://mail.pyt...
...python.org> Status:Rejected Type:Standards Track Created:25-Mar-2015 Python-Version:3.6 Contents Abstract Rationale Proposal Modify PyErr_*() functions to chain exceptions Modify functions to not chain exceptions Modify functions to chain exceptions Backward compatibility Alternatives No change New helpers to chain exceptions Appendix PEPs Python C API Python Issues Rejection Copyright Abstract Chain exceptions at C level, as already done at Python level. Rationale Python...
...Python source tree. DSL overview Type safety and annotations A conversion from a Python to a C value is fully defined by the type of the converter function. The PyArg_Parse* family of functions accepts custom converters in addition to the well-known default converters "i", "f", etc. This PEP views the default converters as abstract functions, regardless of how they are actually implemented. Include/converters.h Converter functions must be forward-declared. All converter functions shall be ...
...Python cfunction object (the self in __call__ or tp_call). This would for example allow implementing the C call protocol for Python functions (types.FunctionType): the C function which implements calling Python functions needs access to the __code__ attribute of the function. This is also needed for PEP 573 where all cfunctions require access to their "parent" (the module for functions of a module or the defining class for methods). Solution: add a new PyMethodDef flag to specify that the C func...
...python.org/3/library/stdtypes.html#dict [2](1, 2) http://docs.python.org/3/library/functions.html#func-range [3]http://docs.python.org/3/library/curses.html#curses.window.border [4]http://docs.python.org/3/library/os.html#os.sendfile [5]http://docs.python.org/3/library/curses.html#curses.window.addch [6]Guido van Rossum, posting to python-ideas, March 2012: https://mail.python.org/pipermail/python-ideas/2012-March/014364.html and https://mail.python.org/pipermail/python-...