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


Groups > comp.lang.python > #93514

Re: (side-)effects and ...

Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.042
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'modify': 0.04; 'term,': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'missed': 0.15; 'mathematics': 0.15; 'expressions?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function).': 0.16; 'well- known': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'result,': 0.18; 'stefan': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'am,': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'written': 0.24; 'mon,': 0.24; 'message-id:@mail.gmail.com': 0.28; 'maybe': 0.31; 'common': 0.33; 'ram': 0.33; 'received:google.com': 0.34; 'replaced': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'so,': 0.37; 'difference': 0.38; 'world,': 0.38; 'mean': 0.38; 'does': 0.39; 'sure': 0.40; 'called': 0.40; 'why': 0.40; 'term': 0.60; 'learn': 0.60; 'real': 0.61; 'side': 0.62; 'world': 0.64; 'between': 0.65; 'jul': 0.72; 'chrisa': 0.84; 'influencing': 0.84; 'phenomenon': 0.84; 'pike': 0.84; 'subject: ...': 0.84; 'to:none': 0.90
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=VVeOmz4clTtMV89tNFwVEWvbyb5OVVlAjb1iHqT8DcE=; b=pEWVtx/lOZwn7EZ5ZwvfUBXb4H2XqoGeCmIBgzs1ARfOQybgQfrFx3NcEvBMjnrwTt kBVrquDK92zBaOARxJ1KCv+8gza2ojUrA4iGege9JYZz+jGj13v7wG+DWBn2aGgJv+ZC J4NlKuUNx4RN2J74gDyPrwnsTQUfkLyZwF+vhjjgaGXY2JBeCgiSb8rwgLHBZHrtiJtr eDnT8iCiIeGAJS2T1ZlIiIKLK9COg5PGbR1DmZtYlmr0wno7mIkY1gwa7rokOQBEjBGF KhMKps0D4myVNNzaDeNLGq4+3zrPW/RjDUiJVGfVAG31aw6/it3+NWYLy6EQhP7bWL6b xPHQ==
MIME-Version 1.0
X-Received by 10.42.216.199 with SMTP id hj7mr32715725icb.11.1436143134577; Sun, 05 Jul 2015 17:38:54 -0700 (PDT)
In-Reply-To <effects-20150705220525@ram.dialup.fu-berlin.de>
References <effects-20150705220525@ram.dialup.fu-berlin.de>
Date Mon, 6 Jul 2015 10:38:54 +1000
Subject Re: (side-)effects and ...
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.310.1436143137.3674.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436143137 news.xs4all.nl 2882 [2001:888:2000:d::a6]:42989
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4475
X-Received-Body-CRC 2737406770
Xref csiph.com comp.lang.python:93514

Show key headers only | View raw


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


Thread

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

csiph-web