Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I get why the function is redundant, but if you're gonna write the types in the doc comment anyway you're basically doing the same thing a programmer using a strictly typed language would do except you're also doing the part the language would do for them.
-
@620hun u can add lint rules to force devs to explicitly mention return types
-
@620hun If this was a strictly typed language the author would've specified that the function returns a number. Failing that, the first person who uses the function would've noticed that it returns void.
-
Seems correct to me. Does what is expected from its name …
if the function otherwise was called like “get and RETURN file size” and returns none, then it would be really wrong … -
@gcavalcante8808 are you joking? Functions starting with "get" always indicate that something is returned. No need to add "getAndReturn" to it. It’s redundant and too long.
-
@Lensflare I’m joking yes haha
Certainly this is not a semantic question hahahaha
Being more serious now, a type check using mypy or a unit test could made the life smooth in this case.
I prefer the unit tests solution, as the return could be of a expected type but is still incorrect (this is a simple case, but you got the ideia I hope).
This was in production for 3 years
rant