Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-20 Thread Ron
Steven Bethard wrote: Ron wrote: How about using ***name in the same way as *name, and **name are used? It extends the current argument options in a consistent manner and 'I believe' is easy to explain and visually says something different is happening here. This builds on the already present

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-19 Thread Kay Schluehr
Bengt Richter wrote: [...] Um, I think that's too narrow for where. Consider foo = f1; bar=f2; x=k1; y=k2 foo(x)*bar(y)[3].attr now should foo(x)*bar(y)[3].attr where: foo = f1; bar=f2; x=k1; y=k2 I think we are diverging again. You are right with Your objection

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-19 Thread Bengt Richter
On 19 Apr 2005 00:16:32 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: Bengt Richter wrote: [...] Um, I think that's too narrow for where. Consider foo = f1; bar=f2; x=k1; y=k2 foo(x)*bar(y)[3].attr now should foo(x)*bar(y)[3].attr where: foo = f1; bar=f2; x=k1; y=k2

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-19 Thread Ron
Kay Schluehr wrote: Steven Bethard wrote: So the object of a where is then always an ordered dict? Yes. If so, then I guess I like this proposal best so far. However, it does seem to have the problem that you can't have any additional local variables so, for example, list comprehensions are

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-19 Thread Steven Bethard
Ron wrote: How about using ***name in the same way as *name, and **name are used? It extends the current argument options in a consistent manner and 'I believe' is easy to explain and visually says something different is happening here. This builds on the already present arg, *arg, **arg, and

Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Reinhold Birkenfeld
Bengt Richter wrote: On Sun, 17 Apr 2005 15:25:04 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Note that there is no problem adding other parameters, because ::suite is just a unary expression returning dict subtype instance, e.g., y = f(11,22,**:: x = 1

Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Ron_Adam
On Mon, 18 Apr 2005 12:50:24 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: y = (f(11, 22, x=1, y='y for f') * g(*args_from_somewhere, x='x for g', y='y for g', foo=lambda: return 'foo for g')) would be my current way to express this. But still, the less lines, the less

RE: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Robert Brewer
Reinhold Birkenfeld wrote: y = (f(11, 22, x=1, y='y for f') * g(*args_from_somewhere, x='x for g', y='y for g', foo=lambda: return 'foo for g')) would be my current way to express this. But still, the less lines, the less confusing it is. And Ron Adam replied: I would

Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Ron_Adam
On Mon, 18 Apr 2005 14:06:08 -0700, Robert Brewer [EMAIL PROTECTED] wrote: Reinhold Birkenfeld wrote: y = (f(11, 22, x=1, y='y for f') * g(*args_from_somewhere, x='x for g', y='y for g', foo=lambda: return 'foo for g')) would be my current way to express this. But still,

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-18 Thread Bengt Richter
On 17 Apr 2005 21:48:47 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: snip I like this. But how would you put where args: and where kw: if you needed both? also, is it looking back to see the '*' or '**' to do (::x=1).values vs. (::x=1) and how about (::x=1).keys() or (::x=1).items() ? And

Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Bengt Richter
On Mon, 18 Apr 2005 12:50:24 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Bengt Richter wrote: On Sun, 17 Apr 2005 15:25:04 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Note that there is no problem adding other parameters, because ::suite is just a unary expression

Re: pre-PEP: Suite-Based Keywords

2005-04-18 Thread Bengt Richter
On Mon, 18 Apr 2005 14:06:08 -0700, Robert Brewer [EMAIL PROTECTED] wrote: Reinhold Birkenfeld wrote: y =3D (f(11, 22, x=3D1, y=3D'y for f') * g(*args_from_somewhere, x=3D'x for g', y=3D'y for g', foo=3Dlambda: return 'foo for g')) would be my current way to express

RE: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Robert Brewer
Bengt Richter wrote: The '::' unary suite operator should return an ordered dict subtype representing the bindings Why ordered? Robert Brewer MIS Amor Ministries [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP: Suite-Based Keywords

2005-04-17 Thread Oren Tirosh
Take a look at Nick Coglan's with proposal: http://groups.google.co.uk/groups?selm=mailman.403.1105274631.22381.python-list%40python.org It addresses many of the same issues (e.g. easy definition of properties). It is more general, though: while your proposal only applies to keyword arguments in

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Kay Schluehr
Robert Brewer wrote: Bengt Richter wrote: The '::' unary suite operator should return an ordered dict subtype representing the bindings Why ordered? Because You can't otherwise guarantee to feed optional argument parameters in a correct way. Example: x = property(*seq) where:

Re: pre-PEP: Suite-Based Keywords

2005-04-17 Thread Bengt Richter
On 16 Apr 2005 23:06:10 -0700, [EMAIL PROTECTED] (Oren Tirosh) wrote: Take a look at Nick Coglan's with proposal: http://groups.google.co.uk/groups?selm=mailman.403.1105274631.22381.python-list%40python.org It addresses many of the same issues (e.g. easy definition of properties). It is more

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Bengt Richter
On 16 Apr 2005 23:43:03 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: Robert Brewer wrote: Bengt Richter wrote: The '::' unary suite operator should return an ordered dict subtype representing the bindings Why ordered? Because You can't otherwise guarantee to feed optional argument

Re: pre-PEP: Suite-Based Keywords

2005-04-17 Thread Brian Sabbey
Oren Tirosh wrote: Take a look at Nick Coglan's with proposal: http://groups.google.co.uk/groups?selm=mailman.403.1105274631.22381.python-list%40python.org It addresses many of the same issues (e.g. easy definition of properties). It is more general, though: while your proposal only applies to

Re: pre-PEP: Suite-Based Keywords

2005-04-17 Thread Brian Sabbey
Brian Sabbey wrote: Does anyone know if the 'where' keyword is only for readability (or does it disambiguate the syntax in some situations)? I think I prefer leaving it off. To answer my own question, I see by reading the where threads that using the 'where' keyword allows things such as: #

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Bengt Richter
On 17 Apr 2005 09:27:34 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: Exactly. Except the above example is from the day-old-bread items-tuple-returning version of :: ;-) And with an ordered dict subtype there is no need for the generator expression either, since there is a values method for

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Steven Bethard
Kay Schluehr wrote: Hmmm ... now You eliminate where completely in favor for '::'. This may be reasonable because '::' is stronger and less context dependent. But on the other hand it may be also reasonable to eliminate '::' towards a stronger where ;) x = property(**kw) where kw: doc

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Kay Schluehr
Bengt Richter wrote: On 17 Apr 2005 09:27:34 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: Exactly. Except the above example is from the day-old-bread items-tuple-returning version of :: ;-) And with an ordered dict subtype there is no need for the generator expression either, since there

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-17 Thread Kay Schluehr
Steven Bethard wrote: So the object of a where is then always an ordered dict? Yes. If so, then I guess I like this proposal best so far. However, it does seem to have the problem that you can't have any additional local variables so, for example, list comprehensions are probably not

Re: pre-PEP: Suite-Based Keywords

2005-04-17 Thread Shane Hathaway
Brian Sabbey wrote: Maybe using '**' would be better than '...' since it already is used to indicate keyword arguments. Example: class C(object): x = property(**): doc = I'm the 'x' property. def fget(self): return self.__x def fset(self, value):

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Bengt Richter
On Fri, 15 Apr 2005 19:32:02 -0700, James Stroud [EMAIL PROTECTED] wrote: I_vote_yes(James): I_understand_what_it_does = True Makes_code_formatting_way_more_managable_in_tough_cases = True Makes_code_way_more_readable = True To_cool = True On Friday 15 April 2005 04:45 pm, Brian

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Bengt Richter
On Fri, 15 Apr 2005 16:45:55 -0700, Brian Sabbey [EMAIL PROTECTED] wrote: Here is a pre-PEP for what I call suite-based keyword arguments. The mechanism described here is intended to act as a complement to thunks. Please let me know what you think. Sorry, I replied to to you via James Stroud's

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Reinhold Birkenfeld
Brian Sabbey wrote: Here is a pre-PEP for what I call suite-based keyword arguments. The mechanism described here is intended to act as a complement to thunks. Please let me know what you think. Suite-Based Keyword Arguments - Passing complicated arguments

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread peufeu
How would you write if f(x=1): print yes using suite-based keyword args? Good point. Then we should remove the extra ':' at the end of the function invocation : if f(x=@): value of x print yes if f(@**): x: value of x print yes --

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-16 Thread Kay Schluehr
The idea is interesting but not unambigously realizable. Maybe one should introduce some extra syntax for disambiguation and thereby generalize the proposal. as specifier: # list of definitions and assignments Proposed specifiers are dict, tuple, *, ** and func. - as dict: conversion

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Nicolas Fleury
Shane Hathaway wrote: I like this PEP a lot, but your concern is valid. Maybe Brian could modify the PEP slightly to disambiguate. How about using an ellipsis in the argument list to signify suite-based keywords? Examples: f(...): x = 1 class C(object): x = property(...): doc = I'm

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Brian Sabbey
Shane Hathaway wrote: Kent Johnson wrote: Brian Sabbey wrote: Using suite-based keyword arguments, the code f(x = 1) is equivalent to f(): x = 1 ISTM the syntax is ambiguous. How do you interpret if f(): x = 1 ? Is a suite alllowed only when a block could not be introduced in the current

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Brian Sabbey
Reinhold Birkenfeld wrote: Brian Sabbey wrote: Here is a pre-PEP for what I call suite-based keyword arguments. The mechanism described here is intended to act as a complement to thunks. Please let me know what you think. Suite-Based Keyword Arguments - Passing

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Brian Sabbey
Bengt Richter wrote: On Fri, 15 Apr 2005 19:32:02 -0700, James Stroud [EMAIL PROTECTED] wrote: I_vote_yes(James): I_understand_what_it_does = True Makes_code_formatting_way_more_managable_in_tough_cases = True Makes_code_way_more_readable = True To_cool = True On Friday 15 April 2005 04:45

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Steven Bethard
Shane Hathaway wrote: I like this PEP a lot, but your concern is valid. Maybe Brian could modify the PEP slightly to disambiguate. How about using an ellipsis in the argument list to signify suite-based keywords? Examples: f(...): x = 1 class C(object): x = property(...): doc = I'm

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-16 Thread Bengt Richter
On 16 Apr 2005 09:07:09 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: The idea is interesting but not unambigously realizable. Maybe one should introduce some extra syntax for disambiguation and thereby generalize the proposal. This is intriguing. I am reminded of trailing where x is something

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Bengt Richter
On Sat, 16 Apr 2005 14:02:32 -0700, Brian Sabbey [EMAIL PROTECTED] wrote: Bengt Richter wrote: On Fri, 15 Apr 2005 19:32:02 -0700, James Stroud [EMAIL PROTECTED] wrote: Examples Using suite-based keyword arguments, the code f(x = 1) is equivalent to f(): x = 1

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Bengt Richter
On Sat, 16 Apr 2005 13:58:38 -0700, Brian Sabbey [EMAIL PROTECTED] wrote: [...] Yes, my description of the syntax was ambiguous. To clarify, I intended the syntax to be backwardly compatible. That is, one would not be able to use a suite to define keywords if there already exists a suite for

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Bengt Richter
On Sat, 16 Apr 2005 14:01:56 -0700, Brian Sabbey [EMAIL PROTECTED] wrote: Reinhold Birkenfeld wrote: Brian Sabbey wrote: Here is a pre-PEP for what I call suite-based keyword arguments. The mechanism described here is intended to act as a complement to thunks. Please let me know what you

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-16 Thread Bengt Richter
On Sun, 17 Apr 2005 01:10:47 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] The :: expression I'm proposing generalizes capturing suite bindings into an ordered sequence of (key,value) tuples, like an ordered vars().items() limited to the bindings produced in the suite following :: Thus

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-16 Thread Kay Schluehr
Bengt Richter wrote: On Sun, 17 Apr 2005 01:10:47 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] The :: expression I'm proposing generalizes capturing suite bindings into an ordered sequence of (key,value) tuples, like an ordered vars().items() limited to the bindings produced in the

pre-PEP: Suite-Based Keywords

2005-04-15 Thread Brian Sabbey
Here is a pre-PEP for what I call suite-based keyword arguments. The mechanism described here is intended to act as a complement to thunks. Please let me know what you think. Suite-Based Keyword Arguments - Passing complicated arguments to functions is currently

Re: pre-PEP: Suite-Based Keywords

2005-04-15 Thread Leif K-Brooks
Brian Sabbey wrote: class C(object): x = property(): doc = I'm the 'x' property. def fget(self): return self.__x def fset(self, value): self.__x = value def fdel(self): del self.__x After seeing this example, I think I'll go on a killing spree

Re: pre-PEP: Suite-Based Keywords

2005-04-15 Thread James Stroud
I_vote_yes(James): I_understand_what_it_does = True Makes_code_formatting_way_more_managable_in_tough_cases = True Makes_code_way_more_readable = True To_cool = True On Friday 15 April 2005 04:45 pm, Brian Sabbey wrote: Here is a pre-PEP for what I call suite-based keyword arguments.

Re: pre-PEP: Suite-Based Keywords

2005-04-15 Thread Kent Johnson
Brian Sabbey wrote: Here is a pre-PEP for what I call suite-based keyword arguments. The mechanism described here is intended to act as a complement to thunks. Please let me know what you think. Suite-Based Keyword Arguments - Passing complicated arguments to