Re: Warning of missing side effects

2009-05-02 Thread Dave Angel
Arnaud Delobelle wrote: Dave Angel writes: Python allows multiple assignments in the same statement, but they're all to the same object. Unless they are to different objects: a, b = 1, 2 You're right, of course. I was referring to the multiple '=' form, and my statement wa

Re: Warning of missing side effects

2009-05-02 Thread Arnaud Delobelle
Dave Angel writes: > Python allows multiple assignments in the same statement, but they're > all to the same object. Unless they are to different objects: a, b = 1, 2 -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Warning of missing side effects

2009-05-02 Thread Dave Angel
Tobias Weber wrote: Hi, being new to Python I find remarkable that I don't see any side effects. That's especially true for binding. First, it is a statement, so this won't work: if x = q.pop(): print x # output only true values Second, methods in the standard library either return

Re: Warning of missing side effects

2009-05-02 Thread Martin v. Löwis
> But I'm used to exploiting side effect, and sometimes forget this rule > in my own classes. IS THERE A WAY to have the following produce a > runtime error? > >def f(): > x = 5 > # no return > >y = f() Typically, this will produce a runtime error fairly quickly, namely whe

Re: Warning of missing side effects

2009-05-02 Thread Pascal Chambon
Tobias Weber a écrit : Hi, being new to Python I find remarkable that I don't see any side effects. That's especially true for binding. First, it is a statement, so this won't work: if x = q.pop(): print x # output only true values Second, methods in the standard library either retu