def pfname(fun):
def wraper(*args,**kwargs):
print fun.__name__
return fun(*args,**kwargs)
return wraper
class ContextWith():
@pfname
def __enter__(self):
return self
@pfname
def __exit__(self,exc_type,exc_value,exc_traceback):
pass
def Helloworld(self):
print "Hello world"
with ContextWith() as ctx:
ctx.Helloworld()
__enter__
Hello world
__exit__