Frank Samuelson <[EMAIL PROTECTED]> wrote:
>> It's also not clear how you expect this to work with anything more
>> complex than a single expression. How do you handle statements and
>> multiple returns?
> >
>> def foo(x, y):
>> L = []
>> try:
>> if x[y] % 2:
>> print x, y
>> return y
>> return x[y]
>> except:
>> return None
>
> Huh? This is trivial. I don't see why this is so hard to grasp.
>
> foo= function(x, y):
> L = []
> try:
> if x[y] % 2:
> print x, y
> return y
> return x[y]
> except:
> return None
>
It is hard to grasp because you said you wanted:
name = function(*argument_list) expression
There is no colon in your proposed syntax, and you only asked for a
single expression in the function rather than a suite. Your 'this is
trivial' response seems to be proposing another syntax entirely.
Unfortunately my crystal ball is away being cleaned, so I am unable to
guess whether you meant for a function definition to be an expression
(opening up a whole host of questions about how you nest it inside other
expressions) or a special case of an assignment to a single name and
wanted to disallow such things as:
foo = l[3] = function(): pass
or if you didn't mean to disallow them, what name should that function
have.
If you are going to make syntax proposals you must be precise.
--
http://mail.python.org/mailman/listinfo/python-list