Title: Define functions without parentheses (if no parameters given)
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.11
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: PedanticHacker, iritkatriel, pablogsal
Priority: normal Keywords:

Created on 2021-06-09 16:54 by PedanticHacker, last changed 2021-06-09 17:15 by pablogsal. This issue is now closed.

Messages (3)
msg395436 - (view) Author: BoĊĦtjan Mejak (PedanticHacker) * Date: 2021-06-09 16:54
The syntax to define a class looks like this:

class MyClass:

Nice and neat.

And the syntax to define a function looks like this:

def my_function():


What if we could define functions (that don't have any parameters) like this:

def my_function:

Is that a possible scenario at this point, or even desirable?
msg395438 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-06-09 17:07
The python-ideas mailing list is a better place for such questions than the bug tracker.
msg395440 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-06-09 17:15
Closing as this would obviously need a PEP, please open a discusion first on python-ideas
Date User Action Args
2021-06-09 17:15:18pablogsalsetstatus: open -> closed

nosy: + pablogsal
messages: + msg395440

resolution: rejected
stage: resolved
2021-06-09 17:07:07iritkatrielsetnosy: + iritkatriel
messages: + msg395438
2021-06-09 16:54:16PedanticHackercreate