Dup Goto 📝

DunderGeq

PT2/lang/python/syntax 11-19 16:53:00
To Pop
18 lines, 52 words, 322 chars Tuesday 2024-11-19 16:53:00
# About as insane as C++'s iostream

class A:
  def __init__(self):
    self.vals = []
  def __str__(self):
    return ", ".join(str(x) for x in self.vals)
  def __ge__(self,x):
    self.vals.append(x)
    return self

a = A()

# note you need the parens here
(((a >= 10) >= 20 ) >= "hello" ) >= "world"
print(a)