[Tutor] Correct style of line break when chaining methods
Mats Wichmann
mats at wichmann.us
Sun Jul 11 19:42:05 EDT 2021
On 7/11/21 1:55 PM, Roel Schroeven wrote:
> Manprit Singh schreef op 10/07/2021 om 18:03:
>
>> And Secondarily when doing work with Numpy arrays and Pandas we are
>> mostly
>> working with chained methods, and at that time, what i feel is a line
>> break
>> can increase readability also .
>
> I think so too. As a general rule, or rather guideline, I think a line
> should as much as reasonably possible express one thought. The exact
> meaning of "one thought" is quite vague, of course; it's more the idea
> that counts than a hard rule.
>
> In this case, I think each of the chained operations constitutes a
> separate thought and therefore deservers to be on its own line.
and this gets back to the original thought... the tendency in the Numpy
world seems to me (just from brief glances, mind) to indeed be to use
these strings of chained methods, and it doesn't have to be that way,
you can save the results and not chain them... :)
More information about the Tutor
mailing list