I am unsure what you want to do. How do you want to use arguments you haven’t declared in a function body? Python doesn’t allow that.
Alright ! my bad , I thought we could use python dictionary to share common arguments among different functions if we use use_kwargs_dict
this way
The usage is for when you have to pass them along to another function. If you need to use them you can’t get away with declaring them.
Hi, is it possible to use, at the same time, the decorators @patch
and @classmethod
? I want to add an additional method for creating a class from a library, and it is giving me weird errors, like:
AttributeError: 'classmethod' object has no attribute '__annotations__'
This is the code I am using:
# export
@patch
@classmethod
def from_poincare_and_index_files(self:TSData, fnames):
return None
Best!
Try perhaps the other way around? (class then patch)
Edit; now that I think about it, that shouldnt work?
Ugh, that avoids my previous error, but the patched method does not work as a class method at all. If I run:
TSData.from_poincare_and_index_files(fnames=[])
I get:
TypeError: from_poincare_and_index_files() missing 1 required positional argument: 'self'
Edit: Maybe you are right, and this just does not make sense at all
Great post, now I know I can not only use fastai to train models but use these to write good code.