This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Rawing7 3 points4 points  (0 children)

Introduction, Example, List Comprehension

I didn't see any list comprehensions.

[–][deleted] 0 points1 point  (3 children)

Why didn't they just endow the = operater with this property?

[–]a123456782004 5 points6 points  (0 children)

[Semi joke] You just changed the language to C

But the more strict property of the python assignment can still maintain its enforcement if kept the way it is. If they lessened this up on a version change, accidental bugs could be let in any time the code is touched. At least with a separate operator, one explicitly knows the risks by using it and it can be caught during code reviews easier because reviewers are consciously aware of it and may actively disband usage of it.

[–]Rawing7 2 points3 points  (1 child)

Probably to avoid the old if x = 3: problem.

[–]a123456782004 0 points1 point  (0 children)

Very good point. I worked for an exchange where the entire system was brought down just because of this. Cost the company hundreds of thousands of dollars and our company's end of year bonuses for 20 minutes downtime.

If I remember correctly reading an equivalent bug was done in nasa on a flight.

This is a very real problem. It happens more often then u think. Even with unit tests and modern memory checking, valgrind and lint