Re: Wrapping float

2005-09-17 Thread Sybren Stuvel
Bengt Richter enlightened us with: > Float is an immutable, so you need to override __new__ Thanks, that works! Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let

Re: Wrapping float

2005-09-17 Thread Robert Kern
Sybren Stuvel wrote: > Hi all, > > I'm trying to make a float-like class (preferably a subclass of > 'float') that wraps around. The background: I'm modeling a > multi-dimensional space, and some of those dimensions are circular. > > Here is my code so far: > > class WrapFloat(float): > def

Re: Wrapping float

2005-09-17 Thread Bengt Richter
On Sat, 17 Sep 2005 11:12:34 +0200, Sybren Stuvel <[EMAIL PROTECTED]> wrote: >Hi all, > >I'm trying to make a float-like class (preferably a subclass of >'float') that wraps around. The background: I'm modeling a >multi-dimensional space, and some of those dimensions are circular. > >Here is my co

Wrapping float

2005-09-17 Thread Sybren Stuvel
Hi all, I'm trying to make a float-like class (preferably a subclass of 'float') that wraps around. The background: I'm modeling a multi-dimensional space, and some of those dimensions are circular. Here is my code so far: class WrapFloat(float): def __init__(self, value, wrap = None):