DEV Community

Discussion on: Variables names don't need their type

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

That beside, if you can't tell the semantic meaning of a variable by its name, and thereby deduce the like type(s) in use, you need better names anyway.

For example, what is the type of is_ready? How about like_count? average_temp? pending_requests? (If you guessed "boolean", "integer", "float", and "something akin to a queue", you're right!)

Collapse
 
waylonwalker profile image
Waylon Walker • Edited

Duck typing 🦆

Thread Thread
 
codemouse92 profile image
Jason C. McDonald

Which reminds me of something I put in my upcoming Python book...

In other words, Python doesn’t care if it’s actually a robotic duck, or a moose in a duck costume; if it has the traits needed, the rest of the details are usually a moot point.