Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93514 > unrolled thread

Re: (side-)effects and ...

Started byChris Angelico <rosuav@gmail.com>
First post2015-07-06 10:38 +1000
Last post2015-07-06 10:38 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: (side-)effects and ... Chris Angelico <rosuav@gmail.com> - 2015-07-06 10:38 +1000

#93514 — Re: (side-)effects and ...

FromChris Angelico <rosuav@gmail.com>
Date2015-07-06 10:38 +1000
SubjectRe: (side-)effects and ...
Message-ID<mailman.310.1436143137.3674.python-list@python.org>
On Mon, Jul 6, 2015 at 6:29 AM, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>   But why do we not have a common and well-known term for
>   the counterpart, that something does not modify the state
>   of the world, but that the state of the world does
>   influence the value (behaviour) of a call such as
>   »datetime.datetime.now().time()«?
>
>   And this is the intention of my post: Maybe there is such
>   a term, and I just missed to learn it so far? So,
>   do you know a term for the phenomenon that can be found
>   in Python but not in mathematics and consists in the state
>   of the world influencing the value of an expressions?

The Pike optimizer short-cuts this by flagging such functions as "have
side effects". As far as optimizers are concerned, there's not a lot
of difference between print() and time(); both of them need to be
called every time they're written (unlike, for instance, math.sin(1)
which can be called once and then replaced with its result, as it's a
pure function). Not sure this helps, but it might indicate why there's
no real term for it - "side effects" kinda can be stretched to mean
both directions.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web