[Python-3000] Type Expressions
Paul Moore
p.f.moore at gmail.com
Fri Apr 21 20:25:47 CEST 2006
On 4/21/06, Guido van Rossum <guido at python.org> wrote:
> On 4/21/06, Talin <talin at acm.org> wrote:
> > The variation that I was thinking of was a little shorter, but not
> > necessarily better:
> >
> > def foo( a, b; x=1, y=2 ): ...
>
> That cropped up in my head too long ago. I think I've seen something
> like this in another language. (Perl? VB?) But it reverses the
> priority of ';' and that's not very nice.
I'm not sure I follow the priority argument (except in a purely
parser-technical sense, I guess). For me, the parentheses ensure that
I only think about the parameter list in relation to the semicolon,
and the semicolon (meaning roughly "and then") nicely splits the
positional arguments from the non-positional ones.
If keyword-only arguments *without* a default were involved,
def foo(a, b; x, y=1): ...
doesn't look good. But I'd be happy with mandating that keyword-only
arguments must have a default (it's similar in principle to the rule
in option parsing that (keyword) options should be optional, and hence
have viable defaults. (See the optparse documentation, section
13.3.1.2 in the Python library reference.)
I prefer semicolon to a bare *, but I'm not going to start a crusade over it...
Paul.
More information about the Python-3000
mailing list