Message65715
> I'd believe you when you say "positional parameters are unnamed", but:
>
> - the language reference contains terms such as "first formal parameter
> name". This means that positional parameters *may* have a name but may
> also have no name?
Correct (although that is actually my interpretation of the
implementation; it's probably not a feature of the language itself).
> - if you define a python function as "def f(a, b, c):" you can call it
> using keyword arguments instead of positional (e.g. f(1, c=3, b=2)).
Unnamed positional parameters are only available in C code. You cannot
write a function with unnamed parameters in Python.
> Could you please explain me what I'm still missing? (I repeat - I met
> python for the first time 2 weeks ago, so it may very well be the case
> that I'm completely wrong)
It's just how PyArg_ParseTuple works: it doesn't receive any parameter
names for the positional parameters, so it can't possibly do the
matching that the language prescribes for positional parameters.
Instead, PyArg_ParseTuple operates *just* by position, hence it
effectively implements unnamed positional parameters.
You are not completely wrong. It's just that this detail is something
most people recognize at some point and accept as a fact, regardless
of what the language specification says (and, as I claim, that text
isn't incorrect - or the implementation isn't incorrect -- it's just
underspecified, failing to mention a detail specific to CPython) |
|
Date |
User |
Action |
Args |
2008-04-24 10:50:20 | loewis | set | spambayes_score: 0.0062654 -> 0.0062654 recipients:
+ loewis, garden |
2008-04-24 10:50:19 | loewis | link | issue2677 messages |
2008-04-24 10:50:19 | loewis | create | |
|