with deyimi 1
This commit is contained in:
parent
88bd36c361
commit
86a40c5d91
16
python-temel/with.deyimi.py
Normal file
16
python-temel/with.deyimi.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class Sample:
|
||||||
|
def __init__(self):
|
||||||
|
print('__init__ called')
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
print('__enter__ called')
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
print('__exit__ called')
|
||||||
|
return False
|
||||||
|
|
||||||
|
print('begins...')
|
||||||
|
with Sample() as s:
|
||||||
|
print('suite')
|
||||||
|
print('ends...')
|
Loading…
Reference in New Issue
Block a user