
On Sat, Apr 25, 2020 at 1:20 AM Soni L. <fakedme+py@gmail.com> wrote:
Currently type(None) returns None if you call it with no args:
print(type(None)()) None
it'd be nice if it did the same regardless of args. currently it raises:
print(type(None)(1)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: NoneType takes no arguments
inspired by PEP 559: https://www.python.org/dev/peps/pep-0559/
NoneType Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'NoneType' is not defined
Why should NoneType be any different from other types? If you want a null function, just create one: def return_none(*_a, **_kw): pass What is your use-case for wanting NoneType to behave in this way? Is this yet another idea that actually has no use-case and is just "wouldn't it be nice if we did weird stuff to the language"? I'm starting to have to read python-ideas by first looking at the poster and only then consider the content of the suggestion, instead of what I usually prefer, which is to evaluate an idea on its merits regardless of who posted it. ChrisA