variable & scoping question.
Diez B. Roggisch
deets at nospam.web.de
Mon Aug 10 17:12:29 CEST 2009
Cornelius Keller wrote:
> I'm a quite fresh python programmer, (6 Month python experience).
> Today I found something I absolotly don'nt understand:
> given the following function:
> def test_effect(class_id=None,class_ids=):
> if class_id is not None:
> if class_id not in class_ids:
> print class_ids
> I observe that the class_ids array is growing when it is called with
> different class id's.
> I expected class_ids to be  if the keyword argument is not set, but
> it seems to beahve like a static variable if not set.
More information about the Python-list