Python Newbie

Ethan Furman ethan at stoneleaf.us
Sun Feb 24 18:53:02 EST 2013


On 02/24/2013 03:38 PM, piterrr.dolinski at gmail.com wrote:
>
>>> intX = 32                          # decl + init int var
>> How is it not obvious that "intX" is an integer *without* the comment?
>
> Indeed the assignment is enough to deduce "intX" is an int. The comment is there to let me know it is unlikely intX appears earlier in the code. Please, let me do things my way until I find reasons to the contrary.

Of course you can, but wouldn't you rather find reasons to the contrary by us telling you, instead of tripping
over something yourself?

For example (I believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to maintain 
X as an integer:

--> intX = 32
--> intX = intX / 3.0
--> intX
10.6666666666

--
~Ethan~



More information about the Python-list mailing list