Python Forum
getting my head arounnd __enter__() for my new class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting my head arounnd __enter__() for my new class
#6
Yes, you're right but this is not related to the __exit__ method.

Here is an example of suppressed exception
>>> class A:
...     def __enter__(self): pass
...     def __exit__(self, *args): return True
... 
>>> with A():
...     1/0
... 
>>> 
Reply


Messages In This Thread
RE: getting my head arounnd __enter__() for my new class - by Gribouillis - Nov-30-2020, 09:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  parser for LVM head Skaperen 0 1,487 Nov-02-2019, 04:04 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020