Hacker News new | ask | show | jobs
by figgis 2835 days ago
See below
1 comments

  Python 3.6.6 (tags/v3.6.6:4cf1f54eb7, Jul  6 2018, 15:35:19) 
  [GCC 4.8.4] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> conditionA = True
  >>> attr = "foo" if conditionA else "bar"
  >>> print(attr)
  foo
  >>> conditionA = False
  >>> attr = "foo" if conditionA else "bar"
  >>> print(attr)
  bar
  >>>