Why '==' ??

Vrai Stacey spam.trap.vrai.stacey at spam.trap.kbcfp.com
Tue Mar 30 08:27:55 EST 2004


I would assume it's because most people come to Python having programmed 
other languages. In most other languages (excepting stuff like 
Pascal/Modula-2/etc ...) '=' is used for assignment and '==' for 
equality. Thus, in the name of aiding the adoption of Python, it makes 
sense to follow this trend.

Fuzzyman wrote:
> I may be about to get flamed as some heretic against the ancient
> way..... but if assignment in conditional statements isn't
> possible.... why do we need to use '==' instead of just '=' for if and
> while statements ?
> 
> It's possible there are places where the interpreter could fail to
> understand it, but I haven't found them yet. If there *aren't* any
> situations where one could be confused for the other... then it's not
> needed and is annoying :-)
> 
> The same could equally well be true for the trailing ':' after def, if
> etc statements..............
> 
> 
> Anyway - not withstanding a  visit from the spanish inquisitionI'd be
> interested to hear.....(And are the spanish inquisition likely to use
> reasoning similar to the sort employed by those who advocate type
> declarations and static languages)...
> 
> Regards,
> 
> Fuzzy
> (recent python addict)
> 
> http://www.voidspace.org.uk/atlantibots/pythonutils.html



More information about the Python-list mailing list