Skip to content
murmot

Results for “python function reference type example code 1 site:discuss.python.org file”

  • discuss.python.org

    Explicit parameter list in function documentation - Documentation...

    General options -C file, --config-file=file. Use this user configuration file rather than the default of ~/.manpath. I can’t reconcile your comments to what I see in the examples you give. You seem to be using “man style” to mean that parameters aren’t listed explicitly...

  • discuss.python.org

    Importing a function - Python Help - Discussions on Python.org

    Jul 22, 2024 · 5 Иван: from levels import level outputs a link to this levels.py Double check that levels.py does in fact contain a level function. Perhaps you have misspelled it as levels or something. Importing a function works as expected, as demonstrated above. You must be doing something different from the code you’ve posted.

  • discuss.python.org

    Type() function in Python

    Jul 10, 2021 ... I know that type() function is used to return the class type of parameter.I wrote the below code class try1 : a = 0 print(type(try1())) ...

  • discuss.python.org

    Python as functional programming language - Python Help...

    The fact that function in python is first-class as you mentioned make me think it can be possible to write code in functional way.Yeah… composition is key to functional programming I think. Composing functions, Composing types(algebraic type system?) bla bla…

  • discuss.python.org

    "import type" statement to replace typing.TYPE_CHECKING idiom ...

    Oct 29, 2024 · There is a common circular reference problem in python’s static typing. For example: example.py from utils import do_things class Example: pass def main(): ex = Example() do_things(ex) utils.py from example import Example from foo_bar import i_look_at_annotations @i_look_at_annotations def do_things(ex: Example): print(f"{ex} is an Example object") This code won’t run due to the circular ...

  • discuss.python.org

    New to Python (learning functions)

    Feb 5, 2023 ... (1) Unless you use Photoshop to write your code, you should not post screenshots of code. Copy and paste it as text, between code fences, as ...

  • discuss.python.org

    How to add methods to immutable types such as str or int or function

    Tried other approaches like function cloning and function attribute attacking by injecting a second co_code in the __code__ values, but I got weird errors about co_args not matching. I didn’t knew Python checked those details before encountering that error.

  • discuss.python.org

    Dealing with forward refs at runtime - Discussions on Python.org

    Oct 30, 2023 · On a loosely related note: I have found it difficult to deal with forward refs at runtime when using either a metaclass or a descriptor’s __set_name__ method to figure out the bound type on the RHS from the annotation on the LHS (kind of like mapped_column works in SQLAlchemy 2.0), since get_type_hints only works if every forward ref can be resolved, it’s always either everything or ...

  • discuss.python.org

    PEP 795 revamped: Deep Immutability for Efficient Sharing and...

    Currently function (and code) objects in Python are dynamic in the sense that they don’t actually hold references to the objects referred by the closures in their body (free variables, globals, builtins).6 LOAD_CONST 1 (<code object function2 at 0x000001FDD0174C60, file "<dis>", line 6>).

  • discuss.python.org

    Extract kwargs types from a function signature - Typing ...

    Sep 20, 2023 · Precise typing of kwargs but without a TypedDict PEP 727: Documentation Metadata in Typing Use * operator to type fixed-size collections Challenges of Static Typing for Curried Functions in Python Structural Pattern Matching for Types PEP Idea: Extend spec of Callable to accept unpacked TypeDicts to specify keyword-only parameters tmk

  • discuss.python.org

    Allowing type hints only on typing.overloads, with an untyped...

    def foo(a): # actual code here. If given no type hints, the type of foo should be the union of its overloads. Currently, you allowed to write something like this if you add # type: ignore on the real function, but I have no real idea if the type checker deal with this as well as I’d hope.

  • discuss.python.org

    Calling a function from another function - Python Help ...

    Mar 7, 2023 · If the summarizetext () function is defined in another file, you need to import it. For example, if the summarizetext () function is defined in a file named otherfile.py, then you would add the following line at or near the top of the file you’ve shown.