Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strange logic! :)
#9
(May-05-2017, 07:22 AM)buran Wrote: @volcano63, I don't understand what you mean that Python programmers don't have to write if 3 == x
Many C/C++ programmers acquire the habit to write if (3 == x) instead of if (x == 3), because if you accidentally omit =, the code will still compile - but the meaning will change.

if (3 = x) is illegal assignment, failing compilation.
(May-05-2017, 07:22 AM)buran Wrote: and once again x = e += 1 is invalid, raising SyntaxError.
I thought I was enhancing your point, not arguing it.
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Messages In This Thread
Strange logic! :) - by alsimm - May-03-2017, 09:49 AM
RE: Strange logic! :) - by buran - May-03-2017, 10:11 AM
RE: Strange logic! :) - by idontreallywolf - May-03-2017, 10:34 AM
RE: Strange logic! :) - by buran - May-03-2017, 10:39 AM
RE: Strange logic! :) - by idontreallywolf - May-05-2017, 06:44 AM
RE: Strange logic! :) - by buran - May-05-2017, 06:53 AM
RE: Strange logic! :) - by volcano63 - May-05-2017, 07:18 AM
RE: Strange logic! :) - by buran - May-05-2017, 07:22 AM
RE: Strange logic! :) - by volcano63 - May-05-2017, 01:03 PM
RE: Strange logic! :) - by nilamo - May-19-2017, 10:03 PM
RE: Strange logic! :) - by volcano63 - May-19-2017, 10:10 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020