Re: [Python-ideas] Add single() to itertools

31 Oct
31 Oct
11:13 p.m.
New subject: Add single() to itertools
On 31Oct2017 22:50, Greg Ewing greg.ewing@canterbury.ac.nz wrote:
Koos Zevenhoven wrote:
|defsingle(i): try: ||v =i.next() |||exceptStopIteration:||||raiseException('No values')|||try: ||i.next() ||exceptStopIteration: ||returnv||else: ||raiseException('Too many values')|||printsingle(name forname in('bob','fred')ifname=='bob')||| |
Looks like a clever method of whitespace compression to me. Those narrow vertical bars take up far less room that spaces!
And so convenient! No dependency on some parochial indentation size policy. - Cameron
2045
Age (days ago)
2045
Last active (days ago)
1 comments
2 participants
participants (2)
-
Cameron Simpson
-
Greg Ewing