>>>>> "David" == David Eppstein <eppstein at ics.uci.edu> writes: David> Currently, I am using expressions like David> pos2d = David> dict([(s,(positions[s][0]+dx*positions[s][2],positions[s][1]+dy*positions[s David> ][2])) David> for s in positions]) which I would have written something like pos2d = dict([(s,(positions[s][0]+dx*positions[s][2], positions[s][1]+dy*positions[s][2])) for s in positions]) so that I could see the relationship between the two tuple elements. [ skipping the avoidance of listcomp syntactic sugar ] David> But with PEP 274, I could write David> pos2d = David> {s:(positions[s][0]+dx*positions[s][2],positions[s][1]+dy*positions[s][2]) David> for s in positions} David> Instead of five levels of nested parens+brackets, I would need David> only three, and each level would be a different type of paren or David> bracket, which I think together with the shorter overall length David> would contribute significantly to readability. which I would still find unreadable and would recast in a more obvious (to me) way as pos2d = {s: (positions[s][0]+dx*positions[s][2], positions[s][1]+dy*positions[s][2]) for s in positions} The extra characters required today are less of a problem if the expression is laid out sensibly. Skip
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