Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
TheVariant354128dWhat? You can declare variables in Python..
@zchfvy Nice to see, that someone actually knows about this nice feature.
I use it frequently to keep track of types myself and help my texteditor with autocompletion.
However, even if the statements work in python, it apparently has no effect, since it doesn't declare the variable.
In general the ": <type>" is only an annotation in python and needs python 3.6+ for it to throw no errors (my rPi for example doesn't have the required version).
@zchfvy I neither checked it before.
I also only knew that you can use them in your code, but actually do nothing to your code other than adding the annotation.
You can use them, but nobody is required to follow them if you e.g. have them as function-parameters. Python does no type-checks by itself.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job