"0 in [True,False]" returns True
Steve Holden
steve at holdenweb.com
Wed Dec 14 03:45:02 EST 2005
Antoon Pardon wrote:
> Op 2005-12-13, Steve Holden schreef <steve at holdenweb.com>:
[...]
>>
>>>But lets make an effort to make the code more readable. What
>>>about the following suggestion. I use a kind of EnumType with
>>>two values: NotRegistered and Registerd. And the name of the
>>>type is NotConnected. So I can then write
>>>
>>> if type(self.callback) is NotConnected.
>>>
>>>Would that be selfdocumenting enough for you?
>>>
>>
>>It would be somewhat more self-documenting, but why not just use one
>>name to indicate the state and another, only meaningful in certain
>>states, to indicate the callback?
>
>
> Why should I do that? Checking the type of a variable is conceptually
> no different form testing set membership. So what I did, was just
> bringing two disjoint sets togther and working with a variable from
> that union. This is all in all a rather simple mathematical idea.
> And I don't see why I should put certain information into a seperate
> variable. It makes as much sense as working with numbers and using
> a seperate variable to store whether a particular number is postive,
> even or has some other characteristic. You don't seperate information
> you can easily acquire from the variable itself. So why should I
> seperate this information that is aquired just as easily?
>
Well, as you might argue, I'm not tryng to effect a change in your
behaviour, I'm simply trying to point out how it could be made more
rational.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list