Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99468 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2015-11-25 10:45 -0700 |
| Last post | 2015-11-25 10:45 -0700 |
| 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: list slice and generators Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-25 10:45 -0700
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-25 10:45 -0700 |
| Subject | Re: list slice and generators |
| Message-ID | <mailman.81.1448473602.20593.python-list@python.org> |
On Wed, Nov 25, 2015 at 10:44 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > On Wed, Nov 25, 2015 at 3:07 AM, Peter Otten <__peter__@web.de> wrote: >>> elif name in METRICS_AVG: >> # writing a function that calculates the average without >> # materialising the list left as an exercise ;) > > metrics = itertools.tee(metrics) > return int(sum(metrics[0]) / len(metrics[1])) Actually, don't do that. It does effectively materialize the list, just not as a list.
Back to top | Article view | comp.lang.python
csiph-web