Python Forum
is this a bug or not with if...else...?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is this a bug or not with if...else...?
#3
looks like it violates PEP 20, but runs.
I don't see where the else is being interpreted as the 1st condition is satisfied.
reversed will give syntax error, because forced to run else code of first statement
a=None; b='abc'; a + ' & ' b if a != None else c = b
Output:
a=None; b='abc'; a + ' & ' b if a != None else c = b ^ SyntaxError: invalid syntax
Reply


Messages In This Thread
is this a bug or not with if...else...? - by meokey - Sep-02-2018, 09:29 PM
RE: is this a bug or not with if...else...? - by Larz60+ - Sep-02-2018, 09:45 PM

Forum Jump:

User Panel Messages

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