DISQUS

R-oooh!-by: Silly comparison gotcha

  • Hendrik Mans · 11 months ago
    It doesn't.

    >> a = 2
    => 2
    >> a == (1 or 2)
    => false

    You'll probably notice that this will, though:

    >> a = 2
    => 2
    >> a == (2 or 1)
    => true

    It works because (2 or 1) evaluates to 2, and a == 2.
  • Carlo Zottmann · 11 months ago
    Holy shit, I am stupid. Danke.