C++ style pass by reference - Ideas - Discussions on Python.org
Dec 18, 2022 ... I propose specifying a function parameter as being pass-by-reference, using the notation “&name” instead of “name”.
Dec 18, 2022 ... I propose specifying a function parameter as being pass-by-reference, using the notation “&name” instead of “name”.
Python is not a purely functional programming language, and though it pains me sometimes, I will prefer an imperative style over a functional one in places where it just fits the language better. A good example are the built-in collection types (list, set, dict).
Sep 27, 2023 ... For example, to create a path that must be an existing file ... types you say you have is to programmatically generate the Python code.
type Example = __import__('example').Example. That is, it creates a TypeAlias whose __value__ lazily evaluates to example.Example.This seems to me more like a code smell. Why does an internal types module of a library need a utility function, if it’s not trying to do too much?
Oct 8, 2022 ... If Python would create a forward reference for the “Y” symbol and ignore the second request to import Y from X, then the loop would be broken, ...
When using the :type: and :rtype: directives, how do we want to mark up multiple types? Currently, we’re using a bar (|), similar to how you’d annotate a union of types: :param p: A parameter that takes an int or a …
I recently encountered a bug in my python project caused because I mistakenly re-assigned a function argument a new value.Ideally, I’d like to explicitly tell type checkers that the function’s argument shall not be reassigned in function’s context: def buggy(x:typing.Final[int])
Oct 11, 2023 ... That's an interesting question. You don't need to use special packages for this (well, depends on how exactly you want to run all this).
A typed function reference can be formed from any function index. The proposal distinguished regular and nullable function reference.Then you have to run the .wasm file, which is a bit tricky. It needs a piece of JavaScript which is currently in src/p2w/runner.py.
Mar 15, 2026 ... Forward Declarations for def and class I propose that Python formally allow forward declarations of functions and classes using the same ...
Jun 19, 2022 ... file syntax · It could be beneficial to put the example code to a function. You can prepare it as a test. · Multiple examples can be in separate ...