[Tutor] Correct style of line break when chaining methods

Manprit Singh manpritsinghece at gmail.com
Sat Jul 10 11:38:53 EDT 2021


Dear sir,

consider a line of code :

csknum = crick.iloc[:, [3, 4, 5]].isin(["CSK"]).all(axis="columns").sum()

This line contains chained methods . What would be an appropriate way to
break this line ?
The way i have done it is given below :

csknum = (crick.iloc[:, [3, 4, 5]]
                  .isin(["CSK"])
                  .all(axis="columns")
                  .sum())

Need your comments

Regards
Manprit Singh


More information about the Tutor mailing list