About 8,530,000 results
Open links in new tab
  1. slice - How slicing in Python works - Stack Overflow

    Python slicing is a computationally fast way to methodically access parts of your data. In my opinion, to be even an intermediate Python programmer, it's one aspect of the language that it …

  2. mean in Python function definitions? - Stack Overflow

    Jan 17, 2013 · In more recent versions of Python >= 3.5, though, it has a defined meaning. PEP 3107 -- Function Annotations described the specification, defining the grammar changes, the …

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

    466 I have a Python function which takes several arguments. Some of these arguments could be omitted in some scenarios.

  4. Explicitly Define Datatype in Python Function - Stack Overflow

    I want to define 2 variables in python function and define them as float explicitly. However, when i tried to define them in the function parameter, it's showing syntax error.

  5. python - What do * (single star) and / (slash) do as independent ...

    Jan 9, 2020 · The function parameter syntax (/) is to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments. (This is new in Python …

  6. How do I declare custom exceptions in modern Python?

    By "modern Python" I mean something that will run in Python 2.5 but be 'correct' for the Python 2.6 and Python 3.* way of doing things. And by "custom" I mean an Exception object that can …

  7. python - What do *args and **kwargs mean? - Stack Overflow

    What exactly do *args and **kwargs mean? According to the Python documentation, from what it seems, it passes in a tuple of arguments. def foo (hello, *args): print (hello) for each in args:...

  8. python - What does ** (double star/asterisk) and * (star/asterisk) …

    Aug 31, 2008 · BONUS: From python 3.8 onward, one can use / in function definition to enforce positional only parameters. In the following example, parameters a and b are positional-only, …

  9. python - What are iterator, iterable, and iteration? - Stack Overflow

    In Python, iterable is an object that is, well, iterable, which simply put, means that it can be used in iteration, e.g. with a for loop. How? By using iterator. I'll explain below. ... while iterator is an …

  10. python - Normal arguments vs. keyword arguments - Stack Overflow

    Sep 13, 2009 · 25 Using Python 3 you can have both required and non-required keyword arguments: Optional: (default value defined for param 'b')