Sorry, I answered only to Eugene...
---------- Forwarded message ---------- From: Vicent <vgi...@gmail.com> Date: Sat, Jan 24, 2009 at 15:42 Subject: Re: [Tutor] Defining "bit" type To: Eugene Perederey <eugene.perede...@gmail.com> On Sat, Jan 24, 2009 at 15:31, Eugene Perederey <eugene.perede...@gmail.com>wrote: > Hi, > type 'bool' takes only True and False. Is it what you want? > > Well, it would be similar, but... This is OK: >>> a = True >>> type(a) <type 'bool'> >>> a == 1 True >>> not a False >>> (not a) == 0 True >>> a*0.5 0.5 >>> a*a 1 >>> type(a) <type 'bool'> But this is not nice: >>> type(a) <type 'bool'> >>> a True >>> a = 0 >>> type(a) <type 'int'> I mean, being "a" a boolean variable, it works as if it was a number, but every time I want to update the value of "a", I must put "False" for 0 and "True" for 1, or it will change into an integer variable. So, maybe I can adapt the definition of "bool" type, I don't know... Anyway, I want to manage 0's and 1's, not "Falses" and "Trues". -- Vicent
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor