fork download
  1. class Foo (object):
  2.  
  3. def __enter__ (self):
  4. print("Enter")
  5. return 1, 2, 3
  6.  
  7. def __exit__ (self, exit, value, exc):
  8. print("Exit")
  9.  
  10. with Foo() as (a, b, c):
  11. print(a, b, c)
  12.  
Success #stdin #stdout 0.01s 27704KB
stdin
Standard input is empty
stdout
Enter
1 2 3
Exit