Re:Ask HN: Good Python codebases to read?
by Xephyrous on Thursday July 16, 2015 @03:04PM
(#9899253)
I'd write that function like this:
This way you don't have to keep track of mutating the path variable. I do find that more readable - it's clearer that there are two paths through the code. That said, this example is trivial enough that I'd probably do it with an inline if/else statement, although still probably not a lambda:
This way it's more obvious at a glance that you're defining a function. It's easier to follow someone else's code if they generally adhere to standards, and Python is a very convention-oriented language.
[ Parent
| on HN ]
There are no comments on this comment yet.