New syntax for blocks

Russ P. russ.paielli at gmail.com
Tue Nov 17 20:36:23 CET 2009


On Nov 17, 7:28 am, Jonathan Saxton <jsax... at appsecinc.com> wrote:
> On Thu, 12 Nov 2009 21:27:31 +0100, Bruno Desthuilliers wrote:
> >> Congratulations, you just reinvented one of the most infamous source of
> >> bugs in C, C++, Java, PHP, javascript and quite a few other languages.
> >> Believe it or not, but not allowing this in Python was a very deliberate
> >> design choice.
>
> > Oh, but those hundreds of thousands of man-hours lost to bugs caused by
> > assignment-as-an-expression is nothing compared to the dozens of man-
> > minutes saved by having one fewer line of code!
>
> > *wink*
>
> And if I ever find the genius who had the brilliant idea of using = to mean assignment then I have a particularly nasty dungeon reserved just for him.  Also a foul-smelling leech-infested swamp for those language designers and compiler writers who followed his example.  (Come to think of it, plagiarizing a bad idea is probably the worse evil.)

There is absolutely nothing wrong with using = for assignment. The
problem in C was allowing an assignment within a conditional
expression. Now *that* was a bonehead idea! (Hingsight is 20/20, of
course.) Python does not allow that, so there is no problem. Nor do
most other languages allow it.



More information about the Python-list mailing list