Unexpected Python Behavior

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Sep 29 23:22:04 EDT 2004


Alex Martelli wrote:
> I think it's in fact very nice syntax:
> 
> def f(x, cache=[]):
>     if x in cache: ...

No, it's not, because it suggests that cache is
intended to be an optional parameter, whereas it
probably isn't.

This is a hack. Don't do it.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list