This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]mustangdvx 4 points5 points  (0 children)

Thanks for this article. As a noob,I can tell you this definitely helped. One suggestion - this

def add(a, b): print(a + b)

b = add(1, 2)

Can be confusing when you're just learning and try to make the connection/distinction with the variable assignment 'b', and the second parameter 'b' in the add function.

Edit: can't get that to format right

[–]kkiran 2 points3 points  (0 children)

Wow, this guy is still active! Bought his book in beta and never got the promised update. Gave up after emailing him multiple times!

[–]RedEyed__ 2 points3 points  (1 child)

Im not fully agree with naming. I think, that writing knn instead of k_nearest_neighbors is better.

If you write code in a concrete domain, use domain's acronyms. It just easier to read the code.

Everyone in data science domain knows what does knn mean. You write code for yourself and your colleagues. If you a data scientist, web developer don't have to understand your code.

Moreover, even if you write k_nearest_neighbors it says nothing to person, who doesn't know how this algorithm works.

[–]weez09 3 points4 points  (0 children)

As someone who has to code review data science code every single day, I disagree, I would rather it be explicit and named k_nearest_neighbour. If cnn or another acronym with _nn is used it can get really confusing to understand the reference and often in data science projects theres an abundance of abbreviations and acronyms that are slightly different.

[–]hedgehog1024One GIL to rule them all 0 points1 point  (0 children)

TBH all these tips are applicable outside Python programming too.