3 ms·
Wrap the statement in (...) and you can drop the backslashes. See also how people split up complicated loc queries in pandas on multiple lines too.
by morkalork 2y ago
Wrap the statement in (...) and you can drop the backslashes. See also how people split up complicated loc queries in pandas on multiple lines too.
- giancarlostoro 2y agoThank you! It seems this works for not just parens but square brackets and curly braces too! Only special requirement is indentation is consistent (duh though). I've not been doing Python day-to-day so I'm starting to lose my touch on all the nice little tricks.
- Rickster35 2y agoYeah, this seems neatest if you don't like line breaks pipeline = ( task(get_data, branch=True) | task(step1, workers=20) | task(step2, workers=20) | task(step3, workers=20, multiprocess=True) ) Square brackets would create a list and braces would create a set of course. The contents still can be split over different lines-- just pointing that this syntax doesn't do the same thing.
- giancarlostoro 2y agoYeah I should have noted that they behave the same in terms of cleaning up a line, not necessarily in terms of what the compiler will do with each token pair.
- asplake 2y agoThe example at https://pyper-dev.github.io/pyper/docs/Examples/ChessDataAnalysis https://pyper-dev.github.io/pyper/docs/Examples/ChessDataAna... does exactly that.