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
In most methods of the DSLParser, self.function can be safely assumed to be an instance of Function. However, it cannot be assumed to be an instance of Function in all methods, because it is set to None in self.reset() before starting to parse a block:
This is a pretty tell-tale sign that function shouldn't really be stored as state at all. Instead, it should be passed into these methods as parameters, and returned from these methods after having been modified. Unfortunately, I think getting there would be a pretty significant refactor...
The text was updated successfully, but these errors were encountered:
In most methods of the
DSLParser
,self.function
can be safely assumed to be an instance ofFunction
. However, it cannot be assumed to be an instance ofFunction
in all methods, because it is set toNone
inself.reset()
before starting to parse a block:cpython/Tools/clinic/clinic.py
Lines 4457 to 4458 in 49f238e
This is a pretty fragile design, and means we have to have a bunch of assertions scattered about the
DSLParser
class in order to keep mypy satisfied:cpython/Tools/clinic/clinic.py
Line 4879 in 49f238e
cpython/Tools/clinic/clinic.py
Line 4884 in 49f238e
cpython/Tools/clinic/clinic.py
Line 4922 in 49f238e
cpython/Tools/clinic/clinic.py
Line 5292 in 49f238e
cpython/Tools/clinic/clinic.py
Line 5306 in 49f238e
This is a pretty tell-tale sign that
function
shouldn't really be stored as state at all. Instead, it should be passed into these methods as parameters, and returned from these methods after having been modified. Unfortunately, I think getting there would be a pretty significant refactor...The text was updated successfully, but these errors were encountered: