Raymond Hettinger wrote: > lastname_firstname = lambda r: (r[0].lower(), r[5].lower()) > for k, g in groupby(iterable, key=lastname_firstname): ... > > That transformation adds clarity. Going further and creating a separate > def-statement outside the current function would just move the relevant > code farther away and impair readability. It doesn't have to be outside the function -- it can be in exactly the same place as the lambda assignment above. def lastname_firstname(r): return (r[0].lower(), r[5].lower()) for k, g in groupby(iterable, key=lastname_firstname): ... Maybe "def is an executable statement" is another thing people have a blind spot about? -- Greg
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