-
Notifications
You must be signed in to change notification settings - Fork 339
Description
If a method (of a class) returns a value, then the else part in the following lines from docstring.py:
Lines 26 to 33 in ce05903
| if class_name is None: | |
| params_section = re.findall( | |
| r"(?<=Parameters)(.*)(?=Returns)", docstring, re.DOTALL | |
| )[0] | |
| else: | |
| params_section = re.findall(r"(?<=Parameters)(.*)", docstring, re.DOTALL)[0] | |
| args = re.findall(r"(\w+)\s+\:", params_section) |
captures that output variable name from its docstring and includes it in the args. This issue was initially exposed when a class with method __call__ was added in PR #1118. One suggestion provided in this comment was:
Given that this is an extreme case, it almost feels like it merits its on elif condition that specifically handles the specific _call_ case?
I think the real question we should ask ourselves is: "Should we treat methods like regular functions, meaning they can return value?
I understand that all methods of all classes in STUMPY main branch currently return nothing ("None"). However, I think it is not unreasonable to assume that, in future, a class might be added that has a method that returns a value. So, maybe we should revise the else part in the code above ??