On 20 Mai, 07:57, Steven D'Aprano
<ste...@remove.this.cybersource.com.au> wrote:
>
> Can you explain how you can tell that there are no side-effects from
> x*sqrt(x)+3 ? What if I have this?
>
> class Funny(object):
>     def __add__(self, other):
>         global parrot
>         parrot += 1
>         return 5 + other
>
> x = Funny()

Yes, in general you need whole-program analysis with Python to know if
there are any side-effects or not. That said, with a process forking
mechanism where modified "globals" are not global beyond each process,
you should be able to guard against side-effects more effectively.

Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to