[Python-ideas] Default arguments in Python - the return - running out of ideas but...

Steven D'Aprano steve at pearwood.info
Fri May 15 11:05:02 CEST 2009


On Fri, 15 May 2009 02:16:04 pm Tennessee Leeuwenburg wrote:
> A thought from another direction...
>
> Any chance we could have the interpreter raise a warning for the case
>
> def foo(a = []):
>   #stuff
>
> ?
>
> The empty list and empty dict args would, I imagine, be the two most
> common mistakes. Showing a warning might, at least, solve the problem
> of people tripping over the syntax.

I made that same suggestion nine months ago:

http://mail.python.org/pipermail/python-list/2008-August/504701.html

Responses were mixed, some people supported it, others did not, but it 
went nowhere.



-- 
Steven D'Aprano



More information about the Python-ideas mailing list