Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32390
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!newsfeed.freenet.ag!news2.euro.net!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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'rename': 0.07; 'wrapped': 0.07; 'iterate': 0.09; 'def': 0.10; 'gui': 0.11; 'suggest': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'immutability': 0.16; 'increment': 0.16; 'locating': 0.16; 'loops': 0.16; 'object).': 0.16; 'oct': 0.16; 'structure.': 0.16; 'wrote:': 0.17; '(in': 0.18; 'trying': 0.21; 'received:209.85.214.174': 0.21; 'example': 0.23; 'programming': 0.23; 'this:': 0.23; 'paul': 0.24; 'header :In-Reply-To:1': 0.25; '[1]': 0.27; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; '(maybe': 0.29; 'tail': 0.29; 'writes:': 0.29; 'case,': 0.29; 'generally': 0.32; 'indexed': 0.33; 'programming,': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'next': 0.35; 'previous': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'your': 0.60; 'relationship': 0.60; '30,': 0.62; 'different': 0.63; 'difficulty': 0.65; 'andrea': 0.84 |
| 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:to :content-type; bh=2XwOyGwN1lCuKDpPHUNKR72dhDLJgkZ46YbDMmxFzn4=; b=F1JuXHk8YTfrydi1kkhudc4qavKWUDdx9VT5wHYOJW8KnKLBVRF9SSI/Kfq7mgmEN4 HSpoJvnCzuLUwegF4HTZT4lHcZptLzdHNQ4c8DpwqFocCxSHMfaQU3i92sxAYilO1qM5 zEsqhXHKL4KUKRgmJJeNAbq3bhOnlHbCjx011Jlxr/DSZmTqYXXGYhb12QWGRh04Xn98 k2cHhN08wAyzLOYCdic77ESbweGDYxptiT/332jFuEHPHQp3RKUnhmOXMOEsder4DuND hMM5FJazTPpb70tqiX8HEVx+2QT1RmMDRL689Lz4knv3smwrnstVxkGPi/pHkyulLBuY yCrQ== |
| MIME-Version | 1.0 |
| In-Reply-To | <7xsj8xl1ct.fsf@ruckus.brouhaha.com> |
| References | <mailman.3018.1351524004.27098.python-list@python.org> <7xsj8xl1ct.fsf@ruckus.brouhaha.com> |
| Date | Tue, 30 Oct 2012 03:08:31 +1100 |
| Subject | Re: Immutability and Python |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3024.1351526914.27098.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351526914 news.xs4all.nl 6855 [2001:888:2000:d::a6]:60709 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32390 |
Show key headers only | View raw
On Tue, Oct 30, 2012 at 2:55 AM, Paul Rubin <no.email@nospam.invalid> wrote: > andrea crotti <andrea.crotti.0@gmail.com> writes: >> and we want to change its state incrementing the number ... >> the immutability purists would instead suggest to do this: >> def increment(self): >> return NumWrapper(self.number + 1) > > Immutability purists would say that numbers don't have "state" and if > you're trying to change a number's state by incrementing it, that's not > immutability. You end up with a rather different programming style than > imperative programming, for example using tail recursion (maybe wrapped > in an itertools-like higher-order function) instead of indexed loops to > iterate over a structure. In that case, rename increment to next_integer and TYAOOYDAO. [1] You're not changing the state of this number, you're locating the number which has a particular relationship to this one (in the same way that GUI systems generally let you locate the next and previous siblings of any given object). ChrisA [1] "there you are, out of your difficulty at once" - cf WS Gilbert's "Iolanthe"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Immutability and Python andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-29 15:20 +0000
Re: Immutability and Python Paul Rubin <no.email@nospam.invalid> - 2012-10-29 08:55 -0700
Re: Immutability and Python Chris Angelico <rosuav@gmail.com> - 2012-10-30 03:08 +1100
Re: Immutability and Python andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-29 16:33 +0000
Re: Immutability and Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-29 23:02 +0000
Re: Immutability and Python rusi <rustompmody@gmail.com> - 2012-10-30 09:22 -0700
Re: Immutability and Python Neal Becker <ndbecker2@gmail.com> - 2012-10-30 16:45 -0400
Re: Immutability and Python rusi <rustompmody@gmail.com> - 2012-10-30 20:21 -0700
Re: Immutability and Python Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-11-08 08:38 +0100
csiph-web