fork download
  1. def ctor():
  2. tits = 0
  3. def fuck(): nonlocal tits; return tits
  4. def suck(): nonlocal tits; tits += 1
  5. return { 'fuck': fuck, 'suck': suck }
  6.  
  7. x = ctor()
  8. print (x['fuck']()) # 0
  9. x['suck']()
  10. x['suck']()
  11. print (x['fuck']()) # 2
Success #stdin #stdout 0.02s 8688KB
stdin
Standard input is empty
stdout
0
2