__main__ : What is this?
Duncan Booth
duncan.booth at invalid.invalid
Sat Oct 20 09:19:02 EDT 2007
"Matt McCredie" <mccredie at gmail.com> wrote:
> or, as I prefer:
>
> a = 'c' == b
>
> It is just habit from writing so much C code that way. In C the
> reasoning is that if you have mistyped it, you will catch the issue at
> compile time instead of runtime (which is potentially much more
> difficult to debug). I'm used to seeing that pattern. In terms of
> natural language I do agree with you. It really is just my _humble_
> opinion. I can't make a huge argument for it in Python. To be honest,
> I didn't give it much thought before I wrote it. I am simply used to
> doing it that way, and being irked whenever I see it written the other
> way in C or C++ (and perhaps unjustifiably Python).
Alternatively you could just tell your C compiler to regard dodgy looking
assignments as an error and stop worrying about it. Much less hassle all
round.
e.g. For gcc -Werror -Wparentheses, for Microsoft compiler -W4 -WX, or an
appropriate #pragma in a header file for each.
More information about the Python-list
mailing list