Python and Flaming Thunder
MRAB
google at mrabarnett.plus.com
Wed May 21 21:49:37 EDT 2008
On May 21, 8:34 pm, Dave Parker <davepar... at flamingthunder.com> wrote:
> 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.
>
I've thought of one possible drawback: "a" and "an" can be used as
variables, so the "is a" part might cause a problem. You'd need to
check the parser to find out...
> 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