DEV Community

Discussion on: Variables names don't need their type

Collapse
 
clairec profile image
Claire Collins • Edited

It needs to be kept as simple as possible. That is the beautiful thing about Python. As long as your code is easy to read and understand, not just by you, but to all else that read it.
When I was going through my course the variables were often referenced with their type, but that just made the learning easier and less confusing whilst learning different types/classes etc.
When you actually start to write your own code then the naming with type is just an incredibly long drawn out process, unnecessarily. If it is a list, you know it's a list because the data is in [ ]. A dictionary is contained within { } so no need to call it a dict as it is obvious with key value pairs.
Some people may still want to use variable types when naming them. You gotta do yourself a favor from a time point of view surely!!
Simple, easy to understand and flowing. I'm a little OCD so I agree with you completely on this one.

Collapse
 
waylonwalker profile image
Waylon Walker

Interesting point with the difference between courses and real work, I hadn't thought about that.

It's also a bit less obvious sometimes where variables are often coming in from other functions that we might no be familiar with.

Collapse
 
codemouse92 profile image
Jason C. McDonald

There's also the fact that a variable's type may change in the course of refactoring, or even executing, a Python program. Systems Hungarian notation is evil in production code.