4 ms·
query = villain.query_joke_formats_and_transports() formats, transports = query or formats, transports = ( villain.query_joke_formats_and_tran
by sago 11y ago
query = villain.query_joke_formats_and_transports()
formats, transports = query
or
formats, transports = (
villain.query_joke_formats_and_transports())
or
formats, transports = \
villain.query_joke_formats_and_transports()
Of which, we tend to do the first.
Again, the longer version is clearer and simpler, but the shorter version is not so confounding that it is a slamdunk argument for longer lines, particularly as, for any length line, you could get this problem, so you'll have to do something like it eventually. If you're seeing this all over the place, it may be worth wrapping the API in more pythonic terms. 'Getters' taking no arguments, for example, are often a code-smell in python, though queries (as in your case) are a good exception, since it is also not great to have properties do expensive work (like querying a DB, say).
- pjtr 11y agoIn reality there are multiple arguments to these functions, I just omitted them here to simplify the example. What other more pythonic terms could be used? The proposed rename to jokes is completely unrealistic. It seems kind of sad to butcher such nice simple code for these artificial non-reasons.