I want to use multiple methods outside of classes. How to define a method outside of a class definition is already answered here.
It seems like a small afterthought, but the brackets for autocompletion and arguments disappear as a result, because it is seen as a field now. As I want to create a bulk of methods that are going to be used frequently, it would be nice to have it show the autocompletion and arguments again. Here is an example of what it's showing, I would like it to autocomplete with brackets and the respective arguments, as you can see with the __dir__(self)
function. And here is the code:
from dataclasses import dataclass
def get_dap(self):
pass
@dataclass
class Country:
ctr_cc: str
ctr_code: str
ctr_name: str
dap = get_dap
@dataclass
class Region(Country):
reg_code: str
reg_name: str
dap = get_dap
dk1 = Region(ctr_cc="DK", ctr_code="DENMARK", ctr_name="Denmark", reg_code="DK1", reg_name="East Denmark")
dk1.get_dap()
I have tried to use some type hinting but I have yet to find a solution.