. Python 2.1 function attributes

Robin Becker robin at jessikat.fsnet.co.uk
Sat Jan 27 09:18:46 EST 2001


In article <mailman.980593892.725.python-list at python.org>, Tim Peters
<tim.one at home.com> writes
....
>Barry also added code to Python 2.1 to let you write, e.g.,
>
>    def f() >> x:
>        x = 1
>        y = 2
>
>as a short way to spell "whatever the value of x is at the end of the
>function, return that".  I'm sure you'll agree that's much cleaner than the
>clumsy
>
>    def f():
>        x = 1
>        y = 2
>        return x
>
>people suffer with today.
>
....
mmmhhhh :( what happens with

def f() >> x:
        return 1


def f() >> x:
        y=2
        return y

seems to me that having multiple ways of doing return is a bad idea
-- 
Robin Becker



More information about the Python-list mailing list