[Tutor] Correct style of line break when chaining methods
Alan Gauld
alan.gauld at yahoo.co.uk
Sat Jul 10 14:58:03 EDT 2021
On 10/07/2021 16:38, Manprit Singh wrote:
> The way i have done it is given below :
>
> csknum = (crick.iloc[:, [3, 4, 5]]
> .isin(["CSK"])
> .all(axis="columns")
> .sum())
>
I don't believe Python has any standard idiom for breaking
chained lines but Smalltalk does so you might copy that.
Smalltalk aligns the dot operators:
csknum = (crick.iloc[:, [3, 4, 5]]
.isin(["CSK"])
.all(axis="columns")
.sum())
It makes it easier to identify the object to which
the chain belongs.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list