Several functions and methods in Sage have mutable default arguments, especially lists. This is generally frowned upon, at least on the Python side (see http://effbot.org/zone/default-values.htm), since it can cause so many subtle bugs, and there's usually no benefit to doing this instead of using a tuple or None (with creation of the mutable argument in the function body).
Are there any objections to fixing this?
Here is a somewhat filtered (and certainly non-exhaustive) output of a naive grep search through the codebase:
Several functions and methods in Sage have mutable default arguments, especially lists. This is generally frowned upon, at least on the Python side (see http://effbot.org/zone/default-values.htm), since it can cause so many subtle bugs, and there's usually no benefit to doing this instead of using a tuple or
None
(with creation of the mutable argument in the function body).Are there any objections to fixing this?
Here is a somewhat filtered (and certainly non-exhaustive) output of a naive grep search through the codebase:
CC: @fchapoton
Component: misc
Issue created by migration from https://trac.sagemath.org/ticket/14795