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

References <20130519002629.GA14025@cskk.homeip.net>
Date 2013-05-19 11:11 +1000
Subject Re: mutable ints: I think I have painted myself into a corner
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1827.1368925919.3114.python-list@python.org> (permalink)

Show all headers | 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