This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: strage default value behaviour
Type: Stage:
Components: None Versions: Python 2.4, Python 2.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, dominik.holler
Priority: normal Keywords:

Created on 2008-09-24 15:17 by dominik.holler, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit dominik.holler, 2008-09-24 15:17
index.html dominik.holler, 2008-09-24 15:17
Messages (3)
msg73718 - (view) Author: (dominik.holler) Date: 2008-09-24 15:17
The behaviour is changing, if I toogle comment lines 10 + 11.

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on
msg73723 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-09-24 15:58
Your script is subject to the "shared default value" syndrome, explained

As indicated in the FAQ, your function could be rewritten like this:

def getElementsByAttrib(self, value, AName="ID-REF", list=None):
  if list is None:
      list = []

to have a less surprising behavior.
msg73745 - (view) Author: (dominik.holler) Date: 2008-09-24 18:33
sorry reporting this bug
Date User Action Args
2022-04-11 14:56:39adminsetgithub: 48208
2008-09-24 18:33:04dominik.hollersetmessages: + msg73745
2008-09-24 15:58:27amaury.forgeotdarcsetstatus: open -> closed
resolution: not a bug
messages: + msg73723
nosy: + amaury.forgeotdarc
2008-09-24 15:17:45dominik.hollersetfiles: + index.html
2008-09-24 15:17:22dominik.hollercreate