Author loewis
Recipients garden, loewis
Date 2008-04-24.10:50:19
SpamBayes Score 0.0062654
Marked as misclassified No
Message-id <481065E9.2070309@v.loewis.de>
In-reply-to <1209033312.75.0.825606815764.issue2677@psf.upfronthosting.co.za>
Content
> 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)
History
Date User Action Args
2008-04-24 10:50:20loewissetspambayes_score: 0.0062654 -> 0.0062654
recipients: + loewis, garden
2008-04-24 10:50:19loewislinkissue2677 messages
2008-04-24 10:50:19loewiscreate