When to use None

Gerrit Holl gerrit.holl at pobox.com
Tue Feb 1 15:17:37 EST 2000


Aahz Maruch wrote on 949428623:
> In article <8779su$sak$1 at nnrp1.deja.com>,  <stevie_deja at my-deja.com> wrote:
> >
> >Would anyone explain to me where there is a difference between the
> >following two calls:
> >
> >if some_var == None :  print 'var is none'
> >
> >if some_var is None :  print 'var is none'
> 
> The latter is faster because it does a direct object comparison rather
> than going through the conversion.

Does this also count for type(a) is type(b)?

There should be a FAQ entry for this one!

regards,
Gerrit.

-- 
Please correct any bad Swahili you encounter in my email message!
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----




More information about the Python-list mailing list