Why does not Python accept functions with no names?

Python python at example.invalid
Sun Feb 20 10:48:33 EST 2022


Abdur-Rahmaan Janhangeer wrote:
> Greetings list.
> 
> Out of curiosity, why doesn't Python accept
> def ():
>      return '---'
> 
> ()
> 
> Where the function name is ''?

For the same reason an empty sequence of characters cannot
be a variable name. Do you know any language (or formal
theory) that allows that?




More information about the Python-list mailing list