You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromos.pathimportjoinclassFileObject:
'''Wrapper for file objects to gets closed on deletion.'''def__init__(self, filepath='~', filename='sample.txt'):
# open a file filename in filepath in read and write modeself.file=open(join(filepath, filename), 'r+')
def__del__(self):
self.file.close()
delself.file
classA(object):
deffoo(self,x):
print"I am a method of A's instance :)"@classmethoddefclass_foo(cls,x):
print"I am a class_method, I know about the class :)"@staticmethoddefstatic_foo(x):
print"I am a static_method, I don't know about the class :)"