About 19,400,000 results
Open links in new tab
  1. 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:...

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

  3. What does -> mean in Python function definitions?

    Jan 17, 2013 · In Python 3.5 though, PEP 484 -- Type Hints attaches a single meaning to this: -> is used to indicate the type that the function returns. It also seems like this will be enforced in …

  4. How to specify multiple types using type-hints - Stack Overflow

    Sep 20, 2025 · I have a function in python that can either return a bool or a list. Is there a way to specify the types using type hints? For example, is this the correct way to do it? def foo(id) …

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

    Sep 13, 2009 · The other concept is on the function definition side: you can define a function that takes parameters by name -- and you don't even have to specify what those names are. …

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

  7. Python class definition syntax - Stack Overflow

    6 A class definition is a bit different from a function/method definition. The parentheses in class definitions are for defining from which class you inherit. You don't write def in front of it, and …

  8. 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.

  9. What does asterisk * mean in Python? - Stack Overflow

    Does * have a special meaning in Python as it does in C? I saw a function like this in the Python Cookbook: def get (self, *a, **kw) Would you please explain it to me or point out where I can …

  10. 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, …