Ka-Ping Yee wrote: > > Taking this all together provides one coherent solution: > > - zip() built-in produces a lazy list-zipper object +1 on this. no performance hit (probably a small gain), "zip" is imho the right name (see e.g. haskell). also answers on c.l.py could be shorter, saving considerable bandwidth <wink> > > - list-comps are written [<expr>, <clause>, <clause>, ...] > where each <clause> is "for x in y" or "if z" +0.5 on the concept, some questions: -------------------------------------------------------------------- I know special character are evil, but in this case I think [<expr> | <clause>, <clause>, ...] would be on order of magnitude easier to read. Why not? -------------------------------------------------------------------- Would [x,y , for x in list1, if x > 1, if y > 2, for y in list2] be allowed? In other words: Should there be some rules of ordering? What would the above list comprehension produce for list1 = list2 = [1, 2, 3]? -------------------------------------------------------------------- Would the following be allowed (and desirable)? y = 3 [ x + y , for x in [1, 2, 3], if x > 1] producing [5, 6] -------------------------------------------------------------------- I don't know Python's parser, so I am sorry if this is a non-issue: How does it resolve the ambiguity between [<expr>, <expr>, ...] and [<expr>, <clause>, <clause>, ...]? Especially something like [x, y, z, for x in l1, for y in l2, for z in l3] concerns me. -------------------------------------------------------------------- that's it for now, Peter -- Peter Schneider-Kamp ++47-7388-7331 Herman Krags veg 51-11 mailto:peter@schneider-kamp.de N-7050 Trondheim http://schneider-kamp.de
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4