On 2020-04-24 12:26 p.m., Chris Angelico wrote:
On Sat, Apr 25, 2020 at 1:20 AM Soni L. <fakedme...@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.

it's not my own use case for once. the PEP clearly lists a use-case. we should support that use-case.


ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/KHRYFINMX4UW5NLB55UJEZT67GUOVK6C/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/L2EZBCGOVOCXYI46OXHHPZDFPWJ3IU3P/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to