A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-September/121768.html below:

[Python-Dev] TypeError: f() missing 1 required positional argument: 'x'

[Python-Dev] TypeError: f() missing 1 required positional argument: 'x'Benjamin Peterson benjamin at python.org
Thu Sep 20 17:14:57 CEST 2012
2012/9/20 Mark Dickinson <dickinsm at gmail.com>:
> And excepting optional ones, too, right?  E.g., the c in
>
>     def foo(a, b, c=1, *args, d):
>         pass
>
> can be passed to by position, but isn't "positional".

Why not?

>>> def f(a, b, c=3): pass
...
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() missing 2 required positional arguments: 'a' and 'b'
>>> f(1, 2, 3, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() takes from 2 to 3 positional arguments but 4 were given



-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4