syntax - Assignment in conditional not permitted in Python? -


why code

if = "hello":     pass 

invalid in python? = "hello" expression value rvalue. it's valid in languages c or php. opinions?

this intentionally made illegal in python allowing huge source of error , making illegal minor inconvenience.

see the design , history faq

my experience in python right. miss not being able this.


Comments

Popular posts from this blog

c# - Sort XmlNodeList with a specific Node value -

actionscript 3 - Equivalent to moveReceived in ElectroServer 5 -

c++11 - Intel compiler and "cannot have an in-class initializer" when using constexpr -