Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93514
| References | <effects-20150705220525@ram.dialup.fu-berlin.de> |
|---|---|
| Date | 2015-07-06 10:38 +1000 |
| Subject | Re: (side-)effects and ... |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.310.1436143137.3674.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: (side-)effects and ... Chris Angelico <rosuav@gmail.com> - 2015-07-06 10:38 +1000
csiph-web