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


Groups > comp.lang.python > #45541

Re: mutable ints: I think I have painted myself into a corner

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'method.': 0.07; 'modify': 0.07; 'subject:into': 0.09; 'toss': 0.09; '"an': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'math,': 0.16; 'simpson': 0.16; 'subclass': 0.16; 'those,': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'creating': 0.23; '(or': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'easier': 0.31; 'anyone': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'are,': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'break': 0.61; 'places': 0.64; 'forward': 0.65; '(that': 0.65; 'subject:have': 0.80; 'subject:think': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=ySX7jo41pOpkGt4yZzAOwjiyqN6AutvIRe0dObhmvKY=; b=Bwa9jYsd4dQ3w+pN8JiPGU41B1E+8pIQaTZgrLTX9JN7JCkAGKnNTfQPp8NYVKsDYe 6q85r1pG+jCifyKduNJwjTBkkTwBYLJkUNlvHel+qDtd+dRyD3eKIs8mxvQkI2nSXazu DVuKDJojx13Ix4Mv6zNs3wBrAP0Fu9IlvnGp3iMbH5u9ZokCqpgXHOsDY1UO7vdEK8pj jsSH3rtWzcqDT5z19KnueAHAJg26j1wXhx6mtCer8miU/cPTAh0pCSpfIvhoQgH7M0Ij P2rW9uV0mwaRHu4jML2bS2PtbCOLAOBDYScqleyPO0VbvgySIKo3CJ4OfG5RO4/Ax6bR aibA==
MIME-Version 1.0
X-Received by 10.52.65.238 with SMTP id a14mr11228609vdt.24.1368925917023; Sat, 18 May 2013 18:11:57 -0700 (PDT)
In-Reply-To <20130519002629.GA14025@cskk.homeip.net>
References <20130519002629.GA14025@cskk.homeip.net>
Date Sun, 19 May 2013 11:11:56 +1000
Subject Re: mutable ints: I think I have painted myself into a corner
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.1827.1368925919.3114.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368925919 news.xs4all.nl 15925 [2001:888:2000:d::a6]:38968
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45541

Show key headers only | View raw


On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson <cs@zip.com.au> wrote:
> Before I toss this approach and retreat to my former "object"
> technique, does anyone see a way forward to modify an int subclass
> instance in place? (That doesn't break math, preferably; I don't
> do arithmetic with these things but they are, after all, ints...)
>

Why is it an int subclass? Because there are places where you want to
use it as though it were an int? It might be easier to render those,
instead, eg by creating a __int__ method. (Or is it "an __int__
method"? Not sure.)

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: mutable ints: I think I have painted myself into a corner Chris Angelico <rosuav@gmail.com> - 2013-05-19 11:11 +1000

csiph-web