On Sat, Apr 25, 2020 at 1:44 AM Soni L. <fakedme...@gmail.com> wrote:
>
>
>
> 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.
>

1) That PEP is rejected YAGNI. So the use-case isn't strong enough.
2) Why should it be NoneType? That makes no sense.

Do you *actually* have a use-case for having NoneType always return
None and ignore its arguments?

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/CQUFSXSTHN5IOYEWIE5DTNNODXEDID54/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to