Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 4:19 PM, Thomas Wouters <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 2:14 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Thomas Wouters's changes for variable tuple packing might fix this, if > > we can agree to add that feature. > In all fairness, liberating the

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Thomas Wouters
On Wed, Apr 2, 2008 at 2:14 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Thomas Wouters's changes for variable tuple packing might fix this, if > we can agree to add that feature. > In all fairness, liberating the argument-unpacking doesn't *require* the variable sequence unpacking patch, al

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Thomas Wouters
On Wed, Apr 2, 2008 at 10:30 PM, Alexander Belopolsky < [EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 3:47 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > > > Thomas Wouters's changes for variable tuple packing might fix > this, if > > > > we can agree to add that feature. > .. >

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Alexander Belopolsky
On Wed, Apr 2, 2008 at 3:47 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > Thomas Wouters's changes for variable tuple packing might fix this, if > > > we can agree to add that feature. .. > > Thomas isn't finished yet. The reason I am asking is that I've been looking into ways of f

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 12:39 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > On Tue, Apr 1, 2008 at 8:14 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > .. > > Thomas Wouters's changes for variable tuple packing might fix this, if > > we can agree to add that feature. > > > > Do you

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Alexander Belopolsky
On Tue, Apr 1, 2008 at 8:14 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: .. > Thomas Wouters's changes for variable tuple packing might fix this, if > we can agree to add that feature. > Do you mean http://bugs.python.org/issue2292 ? From description it does not seem to address function call

Re: [Python-3000] PEP 3102 question

2008-04-01 Thread Guido van Rossum
On Mon, Mar 31, 2008 at 12:12 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > Do I understand correctly that with PEP 3102 implemented, keyword > arguments can follow vararg in function definitions, but doing the > same when calling the function is still a syntax error? > > With the latest

[Python-3000] PEP 3102 question

2008-03-31 Thread Alexander Belopolsky
Do I understand correctly that with PEP 3102 implemented, keyword arguments can follow vararg in function definitions, but doing the same when calling the function is still a syntax error? With the latest py3k, >>> def f(a, *args, v=None): ...pass ... >>> f(a, *args, v=None) File "", line 1

Re: [Python-3000] PEP 3102

2008-03-05 Thread Gustavo Niemeyer
> I guess it might be too late, but has anyone considered: > > def func(normal_arg, *, positional_arg, **, keyword_arg): > pass Or even that, since it's meaningless to have a positional argument in the middle: def func(positional_arg, *, normal_arg, **, keyword_arg): pass -- Gustavo N

Re: [Python-3000] PEP 3102

2008-03-05 Thread Gustavo Niemeyer
> Agreed. Now can you come up with a syntax for positional-only > arguments? So far everybody has failed at that, and there are some use > cases where it's useful too. I guess it might be too late, but has anyone considered: def func(normal_arg, *, positional_arg, **, keyword_arg): pass --

Re: [Python-3000] PEP 3102

2008-02-19 Thread Jim Jewett
On 2/18/08, Adam Olsen <[EMAIL PROTECTED]> wrote: > On Feb 18, 2008 1:17 PM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > A typical use of positional-only arguments is with a function > > def f(x, y=1, **kwargs): > > ... > > > > where keyword arguments are potentially anything at all, i

Re: [Python-3000] PEP 3102

2008-02-19 Thread Arnaud Delobelle
On 19 Feb 2008, at 10:49, Nick Coghlan wrote: [...] >> Such obscure features warrant an obscure yet well-named decorator, >> not >> an obscure syntax that's difficult to get help on. > > It's difficult to handle this in a decorator, as the problem that > occurs is the underlying function repor

Re: [Python-3000] PEP 3102

2008-02-19 Thread Nick Coghlan
Adam Olsen wrote: > Whereas keyword-only arguments force explicitness (at the cost of > brevity), positional-only arguments do the opposite. The default > already allows us to choose brevity when appropriate, and the only > reason I see to force it is when there's a conflict with **kwargs. Which

Re: [Python-3000] PEP 3102

2008-02-18 Thread Adam Olsen
On Feb 18, 2008 1:17 PM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > A typical use of positional-only arguments is with a function > > def f(x, y=1, **kwargs): > ... > > where keyword arguments are potentially anything at all, including x > and y. For example: dict.update(). In fact it

Re: [Python-3000] PEP 3102

2008-02-18 Thread Arnaud Delobelle
On 18 Feb 2008, at 19:39, Talin wrote: > Arnaud Delobelle wrote: >> [...] >> Unconvincingly yours, > > Well, that is certainly a logical continuation of the train of > thought behind the 'single *' syntax. > I'd be curious to know which parts of 3102 people are finding most > useful. You see

Re: [Python-3000] PEP 3102

2008-02-18 Thread Talin
Arnaud Delobelle wrote: > > On Feb 14, 11:13 pm, "Guido van Rossum" <[EMAIL PROTECTED]> wrote: >> On Thu, Feb 14, 2008 at 2:48 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >>> I've been exercising the new keyword-only arguments syntax. It is >>> absolutely wonderful. I'm amazed at how many

Re: [Python-3000] PEP 3102

2008-02-17 Thread Arnaud Delobelle
On Feb 14, 11:13 pm, "Guido van Rossum" <[EMAIL PROTECTED]> wrote: > On Thu, Feb 14, 2008 at 2:48 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > I've been exercising the new keyword-only arguments syntax.  It is > > absolutely wonderful.  I'm amazed at how many long standing problems it >

Re: [Python-3000] PEP 3102

2008-02-15 Thread Talin
Raymond Hettinger wrote: > I've been exercising the new keyword-only arguments syntax. It is absolutely > wonderful. I'm amazed at how many long standing problems it solves elegantly. > > Thanks Talin! Well, that made my day :) -- Talin ___ Python-3

Re: [Python-3000] PEP 3102

2008-02-15 Thread Greg Ewing
Dj Gilcrease wrote: > Positional only args would be arguments that you cannot specify by > keyword, so having a positional only arg that has a default value, > thus making it optional just seems broken to me. There's no logical problem with optional positional-only args -- it just means you have t

Re: [Python-3000] PEP 3102

2008-02-15 Thread Georg Brandl
Dj Gilcrease schrieb: > On Fri, Feb 15, 2008 at 8:46 AM, Joel Bender <[EMAIL PROTECTED]> wrote: >> How about a BNFish notation? Use brackets around optional parameters. >> >> def test([arg1, [arg2,]] arg3): >> ... > > If I understand right, positional only arguments would not be op

Re: [Python-3000] PEP 3102

2008-02-15 Thread Joel Bender
Dj Gilcrease wrote: > If I understand right, positional only arguments would not be optional > in any way shape or form, thats what default arguments are for. I have been expecting that by providing a default value to an argument in the definition that you are making it optional, be it keyword o

Re: [Python-3000] PEP 3102

2008-02-15 Thread Joel Bender
Dj Gilcrease wrote: > On Thu, Feb 14, 2008 at 6:04 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: >> Guido van Rossum wrote: >> > Now can you come up with a syntax for positional-only >> > arguments? So far everybody has failed at that, and there are some use >> > cases where it's useful too. > > >

Re: [Python-3000] PEP 3102

2008-02-15 Thread Dj Gilcrease
On Fri, Feb 15, 2008 at 8:46 AM, Joel Bender <[EMAIL PROTECTED]> wrote: > How about a BNFish notation? Use brackets around optional parameters. > > def test([arg1, [arg2,]] arg3): > ... If I understand right, positional only arguments would not be optional in any way shape or form,

Re: [Python-3000] PEP 3102

2008-02-15 Thread Dj Gilcrease
On Fri, Feb 15, 2008 at 9:37 AM, Dj Gilcrease <[EMAIL PROTECTED]> wrote: > The intent is to make it so (Assuming arg1 and arg2 are positional > only) you cannot do test(arg3=9, arg1=7, arg2=8), thus you would be > required to do test(7, 8, 9) {since doing test(7, 8, arg3=9) would > raise an err

Re: [Python-3000] PEP 3102

2008-02-14 Thread Dj Gilcrease
On Thu, Feb 14, 2008 at 6:04 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > Now can you come up with a syntax for positional-only > > arguments? So far everybody has failed at that, and there are some use > > cases where it's useful too. > > def foo(*(a, b,c)): >...

Re: [Python-3000] PEP 3102

2008-02-14 Thread Greg Ewing
Guido van Rossum wrote: > Now can you come up with a syntax for positional-only > arguments? So far everybody has failed at that, and there are some use > cases where it's useful too. def foo(*(a, b,c)): ... i.e. catch them in a * arg which is unpacked in-place. -- Greg Ewing, Computer Scien

Re: [Python-3000] PEP 3102

2008-02-14 Thread Guido van Rossum
On Thu, Feb 14, 2008 at 2:48 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > I've been exercising the new keyword-only arguments syntax. It is absolutely > wonderful. I'm amazed at how many long standing problems it solves elegantly. Agreed. Now can you come up with a syntax for positional-o

[Python-3000] PEP 3102

2008-02-14 Thread Raymond Hettinger
I've been exercising the new keyword-only arguments syntax. It is absolutely wonderful. I'm amazed at how many long standing problems it solves elegantly. Thanks Talin! Raymond ___ Python-3000 mailing list Python-3000@python.org http://mail.python.o

Re: [Python-3000] PEP 3102 comments

2006-05-25 Thread Greg Ewing
Nick Coghlan wrote: > def f(a, b, *(pos1, pos2), c, d): > # Exactly 2 extra positional arguments required Then someone is going to want def f(a, b, *(pos1, pos2, *args), c, d): # 2 or more positional-only arguments required -- Greg ___

Re: [Python-3000] PEP 3102 comments

2006-05-25 Thread Phillip J. Eby
At 11:42 AM 5/25/2006 +0200, Baptiste Carvello <[EMAIL PROTECTED]> wrote: >maybe those use cases can work without syntactic sugar. With only part 1, you >can already add a manual check if you need: > > >>> def myfunction(a1, a2, *forbidden, kw1, kw2): >...assert forbidden is (), "myfunction()

Re: [Python-3000] PEP 3102 comments

2006-05-25 Thread Guido van Rossum
On 5/25/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > def f(a, b, *(pos1, pos2), c, d): > # Exactly 2 extra positional arguments required -1. This is (nearly?) just an obscure way to say "def f(a, b, pos1, pos2)". Suggestion to everyone: please stop proposing alternatives. Let's instead wor

Re: [Python-3000] PEP 3102 comments

2006-05-25 Thread Nick Coghlan
Greg Ewing wrote: > tomer filiba wrote: >> talin asked for comments, so >> >> def f(a, b, *, c, d) >> >> seems wrong to me. '*' can't be a token on its own, at least >> that's the way i see it. opeators shouldn't stand for themselves. > > But * is not an operator here. It's just a token > with a s

Re: [Python-3000] PEP 3102 comments

2006-05-25 Thread Baptiste Carvello
> > Here's a related but more complicated wish: define a function in such > > a way that certain parameters *must* be passed as keywords, *without* > > using *args or **kwds. This may require a new syntactic crutch. > > While a number of people have submitted possible use cases for this > feat

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Talin
tomer filiba wrote: > talin asked for comments, so > > def f(a, b, *, c, d) > > seems wrong to me. '*' can't be a token on its own, at least > that's the way i see it. opeators shouldn't stand for themselves. > just like the {/} (empty set) was rejected. > Um, before we get all tangled up in sy

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Greg Ewing
Antoine Pitrou wrote: > Why not: > def f(a, b, !c, !d): That looks like "you're not allowed to pass these arguments". :-) -- Greg ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: ht

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Greg Ewing
tomer filiba wrote: > talin asked for comments, so > > def f(a, b, *, c, d) > > seems wrong to me. '*' can't be a token on its own, at least > that's the way i see it. opeators shouldn't stand for themselves. But * is not an operator here. It's just a token with a special meaning in this context

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Benji York
Antoine Pitrou wrote: > Le mercredi 24 mai 2006 à 17:15 -0400, Benji York a écrit : > >>In that case, just use the current default value syntax, sans value (d, >>below): >> >>def f(a, b, c=None, d=): > > Then we can't decide whether "c" can be positional or is keyword-only. True. As I suspect

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Antoine Pitrou
Le mercredi 24 mai 2006 à 17:15 -0400, Benji York a écrit : > In that case, just use the current default value syntax, sans value (d, > below): > > def f(a, b, c=None, d=): Then we can't decide whether "c" can be positional or is keyword-only. ___ Py

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Benji York
Antoine Pitrou wrote: > Why not: > def f(a, b, !c, !d): > > The exclamation mark can be thought to say "you must explicitly mention > this one by its name". > I think having a sigil in front of a variable name is less ugly than > having a separate sigil between commas as a fake parameter. In th

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Antoine Pitrou
Le mercredi 24 mai 2006 à 15:43 -0400, Benji York a écrit : > Hmm, the next best thing I can come up with is: > > def f(a, b, =, c, d): Why not: def f(a, b, !c, !d): The exclamation mark can be thought to say "you must explicitly mention this one by its name". I think having a sigil in front o

Re: [Python-3000] PEP 3102 comments

2006-05-24 Thread Benji York
tomer filiba wrote: > i'd vote for placing it at the end of the last > argument's name, for example: > > def f(a, b*, c, d) Another idea: def f(a, b; c, d): It fails the "syntax variants shouldn't look like grime on your monitor" test though. Hmm, the next best thing I can come up with is: d

[Python-3000] PEP 3102 comments

2006-05-24 Thread tomer filiba
talin asked for comments, so def f(a, b, *, c, d) seems wrong to me. '*' can't be a token on its own, at least that's the way i see it. opeators shouldn't stand for themselves. just like the {/} (empty set) was rejected. anyway, this pep is certainly very useful (i would have used it countless t

Re: [Python-3000] PEP 3102 feedback

2006-05-24 Thread Fred L. Drake, Jr.
Talin writes: > So in other words, nothing has really changed - most people seem to > like the idea of keyword-only arguments, but find the 'required > keyword arguments' syntax confusing. (I haven't found many people > who were in favor of it, however Guido says that's the form that he > pref

Re: [Python-3000] PEP 3102 feedback

2006-05-24 Thread Guido van Rossum
On 5/23/06, Talin <[EMAIL PROTECTED]> wrote: > Well, c.l.p was strangely quiet in response to my posting PEP 3102 a few > days ago. Only two comments, one of a general "ick" variety that seems > mainly based on personal bias, and another which likes the idea but > votes a -1 on the 'naked star' syn

Re: [Python-3000] PEP 3102 feedback

2006-05-24 Thread Michael Chermside
Talin writes: > So in other words, nothing has really changed - most people seem to > like the idea of keyword-only arguments, but find the 'required > keyword arguments' syntax confusing. (I haven't found many people > who were in favor of it, however Guido says that's the form that he > p

Re: [Python-3000] PEP 3102 feedback

2006-05-24 Thread Neal Norwitz
On 5/23/06, Talin <[EMAIL PROTECTED]> wrote: > Well, c.l.p was strangely quiet in response to my posting PEP 3102 a few > days ago. Only two comments, one of a general "ick" variety that seems > mainly based on personal bias, and another which likes the idea but > votes a -1 on the 'naked star' syn

[Python-3000] PEP 3102 feedback

2006-05-23 Thread Talin
Well, c.l.p was strangely quiet in response to my posting PEP 3102 a few days ago. Only two comments, one of a general "ick" variety that seems mainly based on personal bias, and another which likes the idea but votes a -1 on the 'naked star' syntax. So in other words, nothing has really change

Re: [Python-3000] PEP 3102 Open Issues

2006-05-04 Thread Greg Ewing
Talin wrote: > I have to admit that while the reasoning behind the use of the > '*' character is logical, the logic seems a little convoluted. Part of this > is due to the use of negative logic - the absence of something > that would normally be there (i.e. a keyword after the '*') indicates > a r

Re: [Python-3000] PEP 3102 Open Issues

2006-05-04 Thread Guido van Rossum
On 5/3/06, Talin <[EMAIL PROTECTED]> wrote: > 1) Drop this portion of the proposal > 2) Go with the 'naked star' syntax anyway over the objections, and > explain the rationale in the docs; > 3) Come up with a separator character we can agree on > 4) Come up with a brilliantly-devised alternative T

[Python-3000] PEP 3102 Open Issues

2006-05-03 Thread Talin
Given that this PEP is shorter, there is less to discuss. :) It seems that most people are in favor of the first part of the proposal, which is relaxing the restriction that *args must come after any keyword arguments. There is less agreement on the proposal to have non-defaulted arguments after t