Coding standard: Prefixing variables to indicate datatype
Max M
maxm at mxm.dk
Thu Jan 16 04:15:13 EST 2003
Thomas Weholt wrote:
> In my day-job I use Delphi/Object Pascal. My firm has a coding-standard
> where we prefix all variables with a single character to indicate datatype;
> strings are prefixed with s, integers with i, floats with f etc. etc.
>
> Are there any standards like this for Python? Or hints, tips, opinions
> related to this topic?
Yes there are: Dont! ;-)
def adder(ia, ib):
return ia + ib
print adder(40,2)
>>> 42
print adder('40', '2')
>>> 402
You cannot be shure what type a variable will be bound to.
You cannot even be shure that it will stay that type, and then you will
either have to rename them in you entire codebase, or have misleading names.
regards Max M
--
hilsen/regards Max M
http://www.futureport.dk/
Fremtiden, videnskab, skeptiscisme og transhumanisme
More information about the Python-list
mailing list