Hello, this is my first post to this list, but I followed it "passive" since quite some time. I had a thought about distinguishing the list with 1 iterators vs. list comprehension issue that did not appear (at least to my eyes) yet. Why not take the same approach than used for tuples already? like (5) is just the value 5 and (5,) is a 1-tuple containing the value 5 I thought it would be intuitive to have [x**2 for x in range(n)] # be a list comprehension like it currently is [x**2 for x in range(n),] # a list with 1 iterator in it > No, it's a set comprehension where the set elements are pairs. The dict > comprehension would be > > {x: x**2 for x in range(n)} > > Or would that be a single-element dict whose key is x and value is a > generator expression? :-) in this case the same could be applied {x: x**2 for x in range(n)} # dict comprehension {x: x**2 for x in range(n),} # dict with 1 iterator (but "x" is probably not a valid name, is it?) best regards Werner
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