The Python Oracle

Explaining Python's '__enter__' and '__exit__'

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC P Beethoven - Piano Sonata No 2 in A

--

Chapters
00:00 Question
00:33 Accepted answer (Score 610)
01:45 Answer 2 (Score 127)
03:57 Answer 3 (Score 90)
06:43 Answer 4 (Score 86)
07:35 Thank you

--

Full question
https://stackoverflow.com/questions/1984...

Accepted answer links:
[Some more explanation here]: http://effbot.org/zone/python-with-state...
[PEP343 -- The 'with' statement']: https://www.python.org/dev/peps/pep-0343/

Answer 3 links:
https://docs.python.org/2/reference/data...
https://docs.python.org/3/reference/data...
http://effbot.org/zone/python-with-state...
[traceback]: https://docs.python.org/2/library/traceb...
https://docs.python.org/3/library/stdtyp...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #oop #withstatement #contextmanager

#avk47