Python and Flaming Thunder

Dave Parker daveparker at flamingthunder.com
Wed May 21 15:34:36 EDT 2008


On May 21, 1:14 pm, MRAB <goo... at mrabarnett.plus.com> wrote:
> I wonder whether "is" could be used both for "x is value" and "x is a
> type" without causing a problem:
>
> If command is a string ...
>
> If command is "quit" ...

I think you are right.  I like "If command is "quit" ...".  For a user
who wasn't mathemetically inclined and was doing mainly string
manipulation, I think it might be easier to read than the equivalent
"If command = "quit" ...".  By making them exactly equivalent, I can't
think of any confusion that might induce bugs.  If you think of any
drawbacks, please let me know.  Otherwise, I'll put it in the next
time I update the parser (probably this weekend).  Thank you again for
your suggestions.



More information about the Python-list mailing list