Python Newbie

Chris Angelico rosuav at gmail.com
Sun Feb 24 18:45:46 EST 2013


On Mon, Feb 25, 2013 at 10:38 AM,  <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.
>
> Regarding my use of None to mean NULL, point taken to use "" instead.

It's worth noting that None does make a good rendition of
"null-as-opposed-to-blank", for instance when you're fetching data
from an VARCHAR field in an SQL database. You'd use a string for
anything that isn't NULL, and None for the others.

ChrisA



More information about the Python-list mailing list