seeking deeper (language theory) reason behind Python design choice
bartc
bc at freeuk.com
Tue May 15 20:26:38 EDT 2018
On 15/05/2018 21:21, Peter J. Holzer wrote:
> I have been programming in C since the mid-80's and in Perl since the
> mid-90's (both languages allow assignment expressions). I accumulated my
> fair share of bugs in that time, but AFAIR I made this particular error
> very rarely (I cannot confidently claim that I never made it). Clearly
> it is not “a total bug magnet” in my experience. There are much bigger
> problems in C and Perl (and Python, too). But of course my experience is
All those languages use = for assignment and == for equality.
If like me you normally use a language where = means equality (and := is
used for assignment), then you're going to get it wrong more frequently
when using C or Python (I don't use Perl).
You might get it wrong anyway because = is used for equality in the real
world too.
And it's an error that is awkward to detect (in C anyway, as it would be
an error in Python) because usually both = and == are plausible in an
expression.
--
bartc
More information about the Python-list
mailing list