On Sat, Jan 24, 2009 at 18:19, Alan Gauld <alan.ga...@btinternet.com> wrote:
> > If its a single binary digit you want then it would be relatively easy to > define a class. The operations you need would largely be the > comparison and arithmetic ones. But while its not difficult it is > tedious and you would need to think about the Exceptions you > need to raise for carry errors etc. For example what would be the > result of adding two Bits both valued 1. Would the result be a > new zero Bit or an Overflow exception? > > Alan G. > That's a good question... Now, when you add up two booleans valued "True", you get 2: >>> a = True >>> b = True >>> a+b 2 So, maybe I can just build a class that is like a "translator" of True/False into 1/0, but that also admits 1/0 in assignation statements. For my purposes, maybe it is not necessary to handle with many unexpected behaviors... As I am a beginner, I still don't know how to build that class, but I guess Wayne gave me the clue, or something to play with. -- Vicent
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor