Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99216 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-11-22 04:02 +1100 |
| Last post | 2015-11-22 04:02 +1100 |
| 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.
Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?) Chris Angelico <rosuav@gmail.com> - 2015-11-22 04:02 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-11-22 04:02 +1100 |
| Subject | Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?) |
| Message-ID | <mailman.41.1448125341.2291.python-list@python.org> |
On Sun, Nov 22, 2015 at 2:01 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: >> and then the decorator could wrap the function. I'm not entirely sure >> I could implement it reliably, but even leaving that aside, having to >> put "lambda:" in front of everything is pretty ugly. > > Note that "lambda: []" can also be spelled "list". In that particular example, yes. I kept it in the large form to maintain the parallel with the version I was quoting. But if the decorator were to be written, it would probably be something along the lines of "if the default is callable, do the late-binding magic", so 'list' would work just fine. ChrisA
Back to top | Article view | comp.lang.python
csiph-web