Curious assignment behaviour
John W. Baxter
jwbaxter at spamcop.net
Wed Oct 10 16:49:55 CEST 2001
In article <mailman.1002693010.16254.python-list at python.org>, Tim
Peters <tim.one at home.com> wrote:
> It only takes one of those to sour you on the idea for life.
In my case, that event was receiving some C code from a former boss. He
had looked at the assembly output from a problem area of code and was
wondering why the (early C compiler for Intel 8080) was storing a 0
into memory and then immediately reading the value out and checking
whether it was 0*. Indeed, I spotted
if (a = 0) ...
It wasn't long before I started--along with many others--turning
examples with a literal constant around, producing the uglier but safer
if (0 == a) ...
sort of thing.
I don't want to see Python go down this road.
* Can't trust that darn RAM!...which was somewhat true in the late
More information about the Python-list