What is a function parameter =[] for?

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Nov 24 12:32:05 EST 2015


Op 24-11-15 om 17:56 schreef Ian Kelly:

> 
>> So on what grounds would you argue that () is not a literal.
> 
> This enumerates exactly what literals are in Python:
> 
> https://docs.python.org/3/reference/lexical_analysis.html#literals
> 
> I think it's a rather pedantic point, though. How are nuances of the
> grammar at all related to user expectations?
> 

I think that enumaration is too limited. The section starts with:

   Literals are notations for constant values of some built-in types.

() satisfies that definition, which is confirmed by the byte code
produced for it.

-- 
Antoon.



More information about the Python-list mailing list