hi all
please help understand below things in Split dataclass in notebook 08_Datablock
class SplitData():
def init(self, train, valid):
print(‘splid data’)
self.train,self.valid = train,valid
def __getattr__(self,k):
print('__getattr',k)
return getattr(self.train,k)
#This is needed if we want to pickle SplitData and be able to load it back without recursion errors
def __setstate__(self,data:Any): self.__dict__.update(data)
@classmethod
def split_by_func(cls, il, f):
print('il',il,'cls',cls)
lists = map(il.new, split_by_func(il.items, f))
print('lists',cls)
return cls(*lists)
def __repr__(self): return f'{self.__class__.__name__}\nTrain: {self.train}\nValid: {self.valid}\n'
-
At what point of time we call in __get_attri and set_attribute
I get below output after print(splid data)
__getattr ipython_canary_method_should_not_exist
__getattr ipython_display
__getattr ipython_canary_method_should_not_exist
__getattr repr_mimebundle
__getattr ipython_canary_method_should_not_exist
__getattr repr_html
__getattr ipython_canary_method_should_not_exist
__getattr repr_markdown
__getattr ipython_canary_method_should_not_exist
__getattr repr_svg
__getattr ipython_canary_method_should_not_exist
__getattr repr_png
__getattr ipython_canary_method_should_not_exist
__getattr repr_pdf
__getattr ipython_canary_method_should_not_exist
__getattr repr_jpeg
__getattr ipython_canary_method_should_not_exist
__getattr repr_latex
__getattr ipython_canary_method_should_not_exist
__getattr repr_json
__getattr ipython_canary_method_should_not_exist
__getattr repr_javascript
Followed by output of repr -
which function does getattribute invokes is it same __get_attribute ?