why no ++?

Bernd Nawothnig Bernd.Nawothnig at t-online.de
Sun Aug 19 14:28:23 EDT 2001


Hello Alex!

On Sat, 18 Aug 2001 09:13:26 +0200, Alex Martelli <aleaxit at yahoo.com> wrote:

>  "Bengt Richter" <bokr at accessone.com> wrote in message
>  news:3b7de709.3497459 at wa.news.verio.net...
>      ...
>>>    y.a = b,c,d = x.e = wower()

>>> How would you like to rewrite _this_?-)  There is *NO* rewrite

>  [which has been shown to be false, btw]

>> Considering your proposed example, can you state with assurance
>> exactly what order things are done, including side effects?

>  Sure -- Python guarantees left-to-right behavior of this statement.
>  First wower is called, then y.a is assigned, then b,c,d, then x.e, in this
>  order.  But of course it wouldn't be wise to rely on this!-)

Hmm, without having true symbol-expressions (lvals speaken in C-ish) it
makes no difference which of the different symbols is bound physically first
to a value because there can't be any side effect.

Is there a possibility in Python to return a symbol? In other words: is it
possible to write:

a() = 5

if the function a() returns a symbol like in Lisp:

(defun a() 'x)
(set (a) 5) ; x is now bound to 5

In this case it would make a difference.





Bernd



More information about the Python-list mailing list