You don't identify yourself
Published at 18, February 2009, author art. Tags: python, tips
>>> assert( int(0) is not long(0) ) >>> assert( int(0) == long(0) )
So, never write like this:
if var is 0: print 'Cool!'
Because if type(var) == 'long' it does not work.
type(var) == 'long'
Subscribe on this post's comments
permalink
Попробуй assert(type(var).name == 'long')
See also Perils of x is 1.
If you wish to leave comment, please, identify yourself and then come back to this page.
Comments
Subscribe on this post's comments
permalink
Попробуй assert(type(var).name == 'long')
permalink
See also Perils of x is 1.
If you wish to leave comment, please, identify yourself and then come back to this page.