About 814,000 results
Open links in new tab
  1. python - How to use a variable defined inside one function from …

    The simplest option is to use a global variable. Then create a function that gets the current word. Notice that to read global variables inside a function, you do not need to use the global …

  2. python - How can I use a global variable in a function? - Stack …

    Jul 11, 2016 · In Python, the module is the natural place for global data: Each module has its own private symbol table, which is used as the global symbol table by all functions defined in the …

  3. python - How do I forward-declare a function to avoid …

    In python the statement globals()[function_name]() is the same as foo() if function_name = 'foo' for the reasons discussed above, since python must lookup each function before calling it. If one …

  4. mean in Python function definitions? - Stack Overflow

    Jan 17, 2013 · It's a function annotation. In more detail, Python 2.x has docstrings, which allow you to attach a metadata string to various types of object. This is amazingly handy, so Python …

  5. python - How can I define a mathematical function in SymPy?

    68 sympy.Function is for undefined functions. Like if f = Function('f') then f(x) remains unevaluated in expressions. If you want an actual function (like if you do f(1) it evaluates x**2 + 1 at x=1, …

  6. Python - use list as function parameters - Stack Overflow

    Python - use list as function parameters [duplicate] Asked 14 years, 10 months ago Modified 6 years, 3 months ago Viewed 221k times

  7. How do I call a function from another .py file? [duplicate]

    function(a, b) Note that file is one of Python's core modules, so I suggest you change the filename of file.py to something else. Note that if you're trying to import functions from a.py to a file …

  8. python - Variables declared outside function - Stack Overflow

    In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a value anywhere within the function’s body, it’s assumed to be local unless explicitly …

  9. python - How do I get ("return") a result (output) from a function?

    The natural, simple, direct, explicit way to get information back from a function is to return it. Broadly speaking, the purpose of a function is to compute a value, and return signifies "this is …

  10. python - Is nested function a good approach when required by …

    Jan 29, 2011 · Let's say that a function A is required only by function B, should A be defined inside B? Simple example. Two methods, one called from another: def method_a(arg): …