[Guido] > > the proposed notation doesn't return a list. > > ... > > I don't have a proposal for generator comprehension syntax though, and > > [yield ...] has the same problem. [Greg Ewing] > How about just leaving off the brackets? > > gen = yield x*x for x in stuff Heck no! Right now, the only way to tell if a function is a generator is to read through the code looking for a yield. If we do get a generator comprehension syntax, it *must* be distinctively set-off from the surrounding code. Brackets accomplish set-off but look too much like lists. Parens aren't strong enough unless the yield is followed a colon. Someone suggested paired angle brackets (lt and gt) but that was promptly shot down for some reason I can't recall. Curly braces and quotes are probably out of the question. That leaves only dollar signs and other perlisms, yuck. The best so far is (yield: x*x for x in stuff) but someone very important said they hated it for some reason. Perhaps someone can come up with some clever, self explanatory use of --> or some such. Raymond
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