Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88039 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2015-03-26 21:06 +1100 |
| Last post | 2015-03-26 21:06 +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: Supply condition in function call Cameron Simpson <cs@zip.com.au> - 2015-03-26 21:06 +1100
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2015-03-26 21:06 +1100 |
| Subject | Re: Supply condition in function call |
| Message-ID | <mailman.192.1427364402.10327.python-list@python.org> |
On 26Mar2015 10:03, Peter Otten <__peter__@web.de> wrote: >Cameron Simpson wrote: >> vars = locals() >> varnames = list(vars.keys()) > >That leaves varnames in undefined order. Consider > >varnames = sorted(vars) Actually, not necessary. I started with sorted, but it is irrelevant, so I backed off to "list" to avoid introducing an unwarranted implication, in fact precisely the implicaion you are making. The only requirement, which I mentioned, is that the values used to initialise the namedtuple are supplied in the same order as the tuple field names, so all that is needed is to suck the .keys() out once and use them in the same order when we construct the namedtuple. Hence just a list. Cheers, Cameron Simpson <cs@zip.com.au>
Back to top | Article view | comp.lang.python
csiph-web