On 10Jun2021 23:07, Boštjan Mejak <bostjan.xpe...@gmail.com> wrote: >Thank you, Steve, for your answer. You're absolutely right. But I needed an >answer to clarify that my idea, well, sucks. > >I was just relating to class definitions -- being able to do 'class >MyClass: pass' -- and had an idea about having this same >non-parenthesized version in case of no given parameters in a function >definition.
It doesn't suck. Consider, for example, a lambda with no parameters: random16 = lambda: random.randint(1, 16) Stephen is saying it isn't a gleaming nugget of gold that wants, nay, _demands_ to be implelemented. It does really only save a couple of characters and a little visual noise. Another thing to keep in mind with any syntax suggestion (not that it applies well here, because really, what else can your suggestion mean?) it that every addition syntax is a detour into the unused space of possible token paths. This is because the exsiting grammar defines a space of _used_ token paths with existing meanings. Allowing a new path of previously illegal tokens (==> unused and therefore available) should bring a specific benefit, as it _precludes_ that path/syntax from being used for anything else. Python tends to be pretty conservative here: if what you want to write this way can _already_ be written another way which is not really very worse, the benefit the new way brings is small. In a sense this is a similar criterion to the oft cited view that "not everything needs its own function", usually applied to advocating for small one/few line functions to be added to the standard library. So your idea does not suck. But it may not motivate anyone to implement it, or even to agreed that it should be implemented. Cheers, Cameron Simpson <c...@cskk.id.au> _______________________________________________ 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/QWLF6YT64MMJUA7YU4W72XXR3K4HT4V2/ Code of Conduct: http://python.org/psf/codeofconduct/