About 375,000 results
Open links in new tab
  1. Python __call__ special method practical example

    Apr 29, 2011 · The best time to use a callable object over a plain function or a lambda function is when the logic is complex and needs to retain some state or uses other info that in not passed …

  2. python - How to call a script from another script? - Stack Overflow

    Running Python as a subprocess of Python is almost never the correct solution. If you do go with a subprocess, you should avoid Popen unless the higher-level functions really cannot do what …

  3. python - Timeout on a function call - Stack Overflow

    Jan 30, 2009 · I don't think this does answer the question as subprocess.Popen(sys.argv[2:]) would be used to run a command not a Python function call. Unless the intent is to wrap the …

  4. python - How do you call a function in a function ... - Stack Overflow

    2 way to use a function within an other: You define the square() function in another .py file (ex: myfile.py) and then, you can import the function this way: from myfile import square def …

  5. python - What is the difference between __init__ and __call__?

    Mar 12, 2012 · In Python, functions are first-class objects, this means: function references can be passed in inputs to other functions and/or methods, and executed from inside them. Instances …

  6. How do I measure elapsed time in Python? - Stack Overflow

    Welcome to the profile statistics browser. timeStats.profile% stats hello <timestamp> timeStats.profile 224 function calls in 6.014 seconds Random listing order was used List …

  7. python - How does __call__ actually work? - Stack Overflow

    Sep 30, 2015 · Whether an object is an instance of a class with a __call__ method, a function (itself an object), or a builtin object, all calls (except for optimized special cases) arrive at the …

  8. How to call Python functions dynamically - Stack Overflow

    I had a requirement to call different methods of a class in a method of itself on the basis of list of method names passed as input (for running periodic tasks in FastAPI). For executing methods …

  9. python - Calling a function of a module by using its name (a string ...

    Jun 4, 2022 · Module B imports Module A, and invokes function F with a request to call Function G, which is defined in Module B. This call fails because, apparently, function F only runs with …

  10. python - How do I pass a variable by reference? - Stack Overflow

    Jun 12, 2009 · However, const or not, the parameter maintains the reference to the object and reference cannot be assigned to point to a different object within the called function. Python: …

Refresh