About 272,000 results
Open links in new tab
  1. python - Understanding the set () function - Stack Overflow

    Mar 3, 2013 · Internally, the set type is implemented using a hash table: a hash function is used to separate items into a number of buckets to reduce the number of equality operations needed to …

  2. python - How do I define a function with optional arguments? - Stack ...

    See the Python documentation for an excellent summary; the various other answers to the question make use of most of these variations. Since you always have parameters a, b, c in your example and …

  3. python - How can I change a global variable from within a function ...

    This can be justified as follows: if you are using the return within the function, the function will give you a value that can be later used in other functions (i.e. the function return s something you can work …

  4. Time complexity of python set operations? - Stack Overflow

    What is the the time complexity of each of python's set operations in Big O notation? I am using Python's set type for an operation on a large number of items. I want to know how each operation's

  5. How can I specify the function type in my type hints?

    Jun 15, 2016 · How can I specify the type hint of a variable as a function type? There is no typing.Function, and I could not find anything in the relevant PEP, PEP 483.

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

    Jan 30, 2009 · I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds the script

  7. python - What's the pythonic way to use getters and setters? - Stack ...

    I'm doing it like: def set_property(property,value): def get_property(property): or object.property = value value = object.property What's the pythonic way to use getters and setters?

  8. python - How can I use a global variable in a function? - Stack Overflow

    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 module. …

  9. python - How to get all subsets of a set? (powerset) - Stack Overflow

    I am taking a set as input, but it actually could be any iterable, and I am returning a set of sets which is the power set of the input. I like this approach because it is more aligned with the mathematical …

  10. python - How to limit execution time of a function call ... - Stack ...

    Closed 2 years ago. There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally …