On Aug 22, 4:09 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > I suggest that Python should raise warnings.RuntimeWarning (or similar?) > > when a function is defined with a default argument consisting of a list, > > dict or set. (This is not meant as an exhaustive list of all possible > > mutable types, but as the most common ones that I expect will trip up > > newbies.) The warning should refer to the relevant FAQ or section in the > > docs. > > > What do people think? > > I don't see a chance for your proposal. How are you going to detect > mutable objects? Custom types can be mutable as well as immutable. > Could there be a new special method __mutable__? -- http://mail.python.org/mailman/listinfo/python-list
- Should Python raise a warning for mutable default argume... Steven D'Aprano
- Re: Should Python raise a warning for mutable defau... Diez B. Roggisch
- Re: Should Python raise a warning for mutable defau... Christian Heimes
- Re: Should Python raise a warning for mutable defau... Peter Otten
- Re: Should Python raise a warning for mutable d... bearophileHUGS
- Re: Should Python raise a warning for mutab... Peter Otten
- Re: Should Python raise a warning for mutable defau... castironpi
- Re: Should Python raise a warning for mutable defau... Emile van Sebille
- Re: Should Python raise a warning for mutable defau... MRAB
- Re: Should Python raise a warning for mutable d... Christian Heimes
- Re: Should Python raise a warning for mutable defau... Diez B. Roggisch
- Re: Should Python raise a warning for mutable d... Emile van Sebille
- Should Python raise a warning for mutable d... Dan
- Re: Should Python raise a warning for m... Emile van Sebille
- Re: Should Python raise a warning ... Benjamin Kaplan
- Re: Should Python raise a warning for m... Steven D'Aprano
- Re: Should Python raise a warning ... George Sakkis
- Re: Should Python raise a warning for mutable defau... Steven D'Aprano
- Re: Should Python raise a warning for mutable defau... Steven D'Aprano