Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90628 > unrolled thread

Re: a python pitfall

Started bySkip Montanaro <skip.montanaro@gmail.com>
First post2015-05-14 13:55 -0500
Last post2015-05-14 13:55 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: a python pitfall Skip Montanaro <skip.montanaro@gmail.com> - 2015-05-14 13:55 -0500

#90628 — Re: a python pitfall

FromSkip Montanaro <skip.montanaro@gmail.com>
Date2015-05-14 13:55 -0500
SubjectRe: a python pitfall
Message-ID<mailman.15.1431629731.17265.python-list@python.org>
> I saw the following example at
> http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments
> and did not believe the output produced and had to try it for myself....

Pylint (and perhaps other Python "linters") would, I think, warn you
that you were using a mutable object as a default. It's more obvious
that the list is being reused if you call foo with different values
each time.

Skip

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web