Adding a Par construct to Python?
Paul Boddie
paul at boddie.org.uk
Wed May 20 05:39:56 EDT 2009
On 20 Mai, 07:57, Steven D'Aprano
<ste... at 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
More information about the Python-list
mailing list