3 ms·
Python errors out if you don't specify all arguments. >>> def f(a): ... pass ... >>> f() Traceback (most recent call last): File "
by vbit 11y ago
Python errors out if you don't specify all arguments.
>>> def f(a):
... pass
...
>>> f()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() takes exactly 1 argument (0 given)
>>>
I agree 1-based indexing isn't ideal, but in the grand scheme of things, the default nils and the method/function syntax are a constant source of mistakes and frustration for me. In Lua you have to call `obj:method()` which to pass `obj` as the first argument. If you accidentally do `obj.method()` - there is no error, but the first argument becomes `nil`.
In Python, there the call syntax is consistent and `obj` is automatically passed as the first argument for methods.
- pygy_ 11y ago> but the first argument becomes `nil` s/first/last/, the arguments will be shifted to the right. But yes, it can be annoying.