[issue4098] surprised by default list parameter

Torsten Rottmann report at bugs.python.org
Fri Oct 10 11:24:44 CEST 2008


New submission from Torsten Rottmann <trott at meditec-gmbh.com>:

The attached file produced the following result:

______________________
trott$ python2.5 p6.py
[]
[1234]
______________________

I expected both times the empty list since the print
statement prints just a defaulted parameter ("e") which
was defaulted to an empty list literal ("[]") and never set
by supplying an actual class parameter.

The object property "entries" appears to be shared by
both instances. Why?

----------
components: Build
files: p6.py
messages: 74624
nosy: trott
severity: normal
status: open
title: surprised by default list parameter
type: behavior
versions: Python 2.5, Python 2.5.3, Python 2.6
Added file: http://bugs.python.org/file11761/p6.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4098>
_______________________________________


More information about the Python-bugs-list mailing list