
nick coughlan wrote:
No, the idea is for the indented suite to be a perfectly normal suite of Python code. We want to be able to define functions, classes, etc in there.
@Chris Robert sorry what i meant in saying that " a_variable = an_expression" is that, it seems to me, at least, the only allowed statements are ones where a variable is set to a value, which includes "class" and "def" (and some control flow, if, else etc.)
also in the first post: Sergio Davis wrote:
I'm considering the following extension to Python's grammar: adding the
'where' keyword, which would work as follows:
where_expr : expr 'where' NAME '=' expr
On Tue, Jul 20, 2010 at 10:56 PM, Chris Rebert pyideas@rebertia.com wrote:
On Tue, Jul 20, 2010 at 7:50 PM, Alex Light scialexlight@gmail.com wrote:
Carl M. johnson wrote:
2.) What happens in this case:
x = y given: return "???"
Do we just disallow return inside a given? If so, how would the parser know to allow you to do a def inside a given?
i think so because unless i am misunderstanding something the only
allowed
expressions in a 'given' block would be of the type: a_variable = an_expression
Incorrect. Yes, you are misunderstanding:
On Tue, Jul 20, 2010 at 3:13 PM, Nick Coghlan ncoghlan@gmail.com wrote:
On Wed, Jul 21, 2010 at 6:13 AM, Alex Light scialexlight@gmail.com
wrote:
i would use as because this whole where clause acts very similarly to a context manager in that it sets a variable to a value for a small block
No, the idea is for the indented suite to be a perfectly normal suite of Python code. We want to be able to define functions, classes, etc in there. Inventing a new mini-language specifically for these clauses would be a bad idea (and make them unnecessarily hard to understand)
<snip> > Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
Did you not read Nick's reply yet when you wrote this, or...?
Cheers, Chris -- http://blog.rebertia.com