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

2013-05-19 Thread Cameron Simpson
On 20May2013 13:23, Greg Ewing wrote: | Cameron Simpson wrote: | >It's an int _subclass_ so that it is no bigger than an int. | | If you use __slots__ to eliminate the overhead of an | instance dict, you'll get an object consisting of a | header plus one reference, which is probably about the | s

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

2013-05-19 Thread Cameron Simpson
On 19May2013 09:01, Peter Otten <__pete...@web.de> wrote: | Cameron Simpson wrote: | | > TL;DR: I think I want to modify an int value "in place". | > | > Yesterday I was thinking about various "flag set" objects I have | > floating around which are essentially bare "object"s whose attributes | >

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

2013-05-19 Thread Gregory Ewing
Cameron Simpson wrote: It's an int _subclass_ so that it is no bigger than an int. If you use __slots__ to eliminate the overhead of an instance dict, you'll get an object consisting of a header plus one reference, which is probably about the size of an int. But you'll also need an int to put i

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

2013-05-19 Thread Peter Otten
Cameron Simpson wrote: > TL;DR: I think I want to modify an int value "in place". > > Yesterday I was thinking about various "flag set" objects I have > floating around which are essentially bare "object"s whose attributes > I access, for example: > > flags = object() > flags.this = True >

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

2013-05-18 Thread Cameron Simpson
On 19May2013 11:11, Chris Angelico wrote: | On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson 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

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

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson 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 the

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

2013-05-18 Thread Cameron Simpson
TL;DR: I think I want to modify an int value "in place". Yesterday I was thinking about various "flag set" objects I have floating around which are essentially bare "object"s whose attributes I access, for example: flags = object() flags.this = True flags.that = False and then elsewhere: