Show More
@@ -32,10 +32,20 b' class _hybrid(object):' | |||||
32 | """ |
|
32 | """ | |
33 |
|
33 | |||
34 | def __init__(self, gen, values, makemap, joinfmt): |
|
34 | def __init__(self, gen, values, makemap, joinfmt): | |
35 |
|
|
35 | if gen is not None: | |
|
36 | self.gen = gen | |||
36 | self._values = values |
|
37 | self._values = values | |
37 | self._makemap = makemap |
|
38 | self._makemap = makemap | |
38 | self.joinfmt = joinfmt |
|
39 | self.joinfmt = joinfmt | |
|
40 | @util.propertycache | |||
|
41 | def gen(self): | |||
|
42 | return self._defaultgen() | |||
|
43 | def _defaultgen(self): | |||
|
44 | """Generator to stringify this as {join(self, ' ')}""" | |||
|
45 | for i, d in enumerate(self.itermaps()): | |||
|
46 | if i > 0: | |||
|
47 | yield ' ' | |||
|
48 | yield self.joinfmt(d) | |||
39 | def itermaps(self): |
|
49 | def itermaps(self): | |
40 | makemap = self._makemap |
|
50 | makemap = self._makemap | |
41 | for x in self._values: |
|
51 | for x in self._values: |
General Comments 0
You need to be logged in to leave comments.
Login now