[Python-3000] List-Comp style for loops?

Ronald Oussoren ronaldoussoren at mac.com
Sat Apr 8 21:00:41 CEST 2006


On 8-apr-2006, at 5:44, Guido van Rossum wrote:

> On 4/7/06, Crutcher Dunnavant <crutcher at gmail.com> wrote:
>> Basic idea:
>>
>> [for ... in ...]+ if ...:
>>   body
>>
>> A) it should be syntatically simple to parse.
>> B) it establishes a nice symetry with list comprehensions.
>
> Are you in cahoots with the person who posted the first response to my
> Artima blog on today? :-)
> (http://www.artima.com/forums/flat.jsp?forum=106&thread=155514)
>
> I can't make heads or tails of this. What is it supposed to do? What
> is it supposed to replace?

My guess is that he doesn't get generic/overloaded/extensible functions
and proposes a way to extend function bodies through some very odd
syntax.

foo = if x:
    print "x!"

foo += elif y:
    print "y!"

would probably be get you a function like this:

def foo():
    if x:
      print "x!"
    elif y:
      print "y!"

I'd say this wouldn't be an improvement to python ;-)

Ronald

>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/ 
> ronaldoussoren%40mac.com



More information about the Python-3000 mailing list