C
Chris Cioffi
Hello all!
I'm trying to subclass int such that once it reaches a certain value,
it flips back to the starting count. This is for use as an X12
control number. Subclassing int and getting the display like I want
it was trivial, however what's the best way to make it such that:
990 + 1 = 991
991 + 1 = 992
....
998 + 1 = 999
999 + 1 = 001
Should I set any of the special functions like __sub__ to raise
NotImpemented and just make my own custom assignment and __add__
functions? (The other fucntions would make no sense in this
context...)
Is there an "on change" kind of meta-function? (Like the onChange
event in a GUI text control)
Chris
I'm trying to subclass int such that once it reaches a certain value,
it flips back to the starting count. This is for use as an X12
control number. Subclassing int and getting the display like I want
it was trivial, however what's the best way to make it such that:
990 + 1 = 991
991 + 1 = 992
....
998 + 1 = 999
999 + 1 = 001
Should I set any of the special functions like __sub__ to raise
NotImpemented and just make my own custom assignment and __add__
functions? (The other fucntions would make no sense in this
context...)
Is there an "on change" kind of meta-function? (Like the onChange
event in a GUI text control)
Chris