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
#2
I don't think __enter__ takes any argument apart from self. It may return anything.

As the documentation says, the return value of __exit__ is converted into a boolean to see if the potential exception that occurred in the with block should be suppressed or propagated. The default is propagated because functions return None by default.
Reply


Messages In This Thread
RE: getting my head arounnd __enter__() for my new class - by Gribouillis - Nov-28-2020, 12:18 PM

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