Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85225 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2015-02-04 10:15 -0700 |
| Last post | 2015-02-04 10:15 -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: basic generator question Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-04 10:15 -0700
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-02-04 10:15 -0700 |
| Subject | Re: basic generator question |
| Message-ID | <mailman.18471.1423070186.18130.python-list@python.org> |
On Wed, Feb 4, 2015 at 6:23 AM, Neal Becker <ndbecker2@gmail.com> wrote:
> class rpt:
> def __init__ (self, value, rpt):
> self.value = value; self.rpt = rpt
> def __call__ (self):
> for i in range (self.rpt):
> yield self.value
Note that this class is just reimplementing itertools.repeat.
>>> list(itertools.repeat('hello', 5))
['hello', 'hello', 'hello', 'hello', 'hello']
Back to top | Article view | comp.lang.python
csiph-web