aeros167, uranusjr,
Thank you for your responses.
I haven’t taken time to figure out the markdown style for Discord yet. So, rather than block quotes, let me try and respond to some of the concerns raised by both of you:
-
return
andreturn None
can be used interchangebly, making them “intuitive enough”, but this does not makes them unambiguous.For example, void type methods don’t exist in Python[1]. So, to someone familiar with the concept, doing
return
might be surprised thatreturn
is actually returning anything at all. This might be a little bit weird for Java converts, for example, as they learn that void is not a Python concept, really. -
Updating PEP-8 for more clarity and encouraging Linters to do the same would be an acceptable start. I don’t think the language standard needs to be updated to actually deprecate the bare return. Perhaps we could in the future, similar to [2], but such a change would have to be much more deliberate, and probably go through the PEP dance.
-
Re: updating the repos to default to
return None
overreturn
being a non-zero engineering effort – I could probably do that in a weekend if folks would find the change beneficial. It’d be good experience learning GitHub/git/Python Developer Workflow, etc. -
aeros167@, thanks for getting-started resources
Further, I’d like to support my position with the following:
return
vs return None
is inconsistent with PEP 20 [3].
“Explicit is better than implicit.”
“There should be one-- and preferably only one --obvious way to do it.”
return
is implicit, and the fact that the language spec supports both return
and return None
is repetitive and non-obvious.
Cheers,
Brugz
[1] https://www.tutorialspoint.com/How-to-return-void-from-Python-function
[2] Deprecate bare except
[3] https://www.python.org/dev/peps/pep-0020/