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
Null objects must be at the end of the matching chain,
i.e., their restmust be None,
so we remove the rest parameter from the class's constructor
and pass None up to the parent constructor every time.
But the code does NOT call the parent constructor at all.
does not work either: this would create a new Null() and recurses endless.
Actually the value self.rest is never used, so it could be anything. IMHO: Setting the value of None breaks the class invariant: because of the if in the constructor the value is never None. If this classes get more methods this will break and somebody has to keep all the broken parts 😁.
The text was updated successfully, but these errors were encountered:
But the code does NOT call the parent constructor at all.
Calling with
does not work either: this would create a new
Null()
and recurses endless.Actually the value
self.rest
is never used, so it could be anything. IMHO: Setting the value ofNone
breaks the class invariant: because of theif
in the constructor the value is neverNone
. If this classes get more methods this will break and somebody has to keep all the broken parts 😁.The text was updated successfully, but these errors were encountered: