. Python 2.1 function attributes

Robin Becker robin at jessikat.fsnet.co.uk
Sat Jan 27 11:37:47 EST 2001


In message <14962.62953.304511.523826 at anthem.wooz.org>, Barry A. Warsaw
<barry at digicool.com> writes
....
>
>It was a joke.  Tim meant to write "def f() << x" because "the
>function f `gets' the value of x".  The patch also places the return
>value as a function attribute so you really write it like this:
>
>def f() << x:
>    x = 1
>    y = 2
>
>print f.x
>
>That both calls f and returns the x attribute value.  Add in
>__setattr__ semantics and arguments as list comprehensions, and you
>get the power and clarity of:
>
>>>> def f(x * [x-1 for x > 1]) << x: pass
>...
>>>> print f.x = 5
>120
>
>What could be more natural than that? <wink, wink, nudge, nudge>
....
aaarrggghhhh the Inquisition auto da fe with << and >>
-- 
Robin Becker




More information about the Python-list mailing list