meatball133 / nimble-neutrinos

MIT License
0 stars 0 forks source link

Should we use typing? #2

Open meatball133 opened 3 months ago

meatball133 commented 3 months ago

This is a question which often leaves python developers in two corners. Some say typing shouldnt be used since it ruines pythons dynamic nature other claim it improves structure.

I have checkedthe judging guidelines and it says nothing about types being judged which I agree with, but we have to decide if we are to use types or not. I don't want someone to write a class called Incoming with all types and then someone else write Outgoing with no types. It makes the codebase very inconsistent. I leave two options: either we use gradually typing, where we put types where they make sense, like function defention, but perhaps not: url : str = "https://google.com". Alternativly we use pure dynamic typing.

I found this article quite good discusing typed vs untyped (forgot to post the article): https://realpython.com/python-type-checking/#pros-and-cons

malik1004x commented 3 months ago

Since we're going to be judged on cleanliness of code I would definitely vote for using typehinting. Code being easy to read, follow and extend is more important than it being "Pythonic".

malik1004x commented 3 months ago

but perhaps not: url : str = "https://google.com"

If we're declaring and initializing on the same line, then yes, typehinting is just unnecessary clutter – for the same reason we have auto in C++.

GetPsyched commented 3 months ago

I prefer typed code. It's objectively safer.

Jer-Dan commented 3 months ago

Typed code will definitely make the code less confusing, especially since this project involves a lot of collaboration. Since the quality and cleanliness of our code is being judged, I say we go for it.