I think this takes the discussion in a more practical direction. Imagine that there were a special method name __immutable__ to be implemented appropriately by all builtin types. Any object passed as a default argument would be checked to see that its type implements __immutable__ and that __immutable__() is True. Failure would mean a warning or even an error in subsequent versions.
User-defined types could implement __immutable__ as they saw fit, in the traditional Pythonic consenting-adults-ly way.
A thought from another direction...
Any chance we could have the interpreter raise a warning for the case
def foo(a = ):
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.
Python-ideas mailing list