Closed
Description
Similarly to what's already been said on the mailinglist, I don't think an explicit return None
should count as useless return.
Consider this class:
class PseudoLayout(QLayout):
# [...]
def count(self) -> int:
return 0
def itemAt(self, _pos) -> Optional[QWidget]:
return None
Here, I do need to override itemAt
(because PyQt or rather C++ tells me to), but my layout never actually has any items in it, so I always want to return None
.
Sure, from Python's perspective, I might as well just put pass
there and rely on the implicit return None
, but IMHO this is a case of "explicit is better than implicit". The function is clearly intended to return something (and not just there for it's side effects), so IMHO, there should be an explicit return
here.
Metadata
Assignees
Labels
No labels