Why aren't my user defined class attributes and methods available using the 'with' context manager keyword? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Why aren't my user defined class attributes and methods available using the 'with' context manager keyword?

Context Manager and User Classes

5th Mar 2017, 7:31 PM
tom d
tom d - avatar
1 Respuesta
0
you need to implement __enter__ and __exit__ methods in order to have a context manager
5th Mar 2017, 10:45 PM
Amaras A
Amaras A - avatar