[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] [cvs2svn] Code cleanup - eliminate duplicate code

From: Gareth McCaughan <gareth.mccaughan_at_pobox.com>
Date: 2003-08-27 00:17:26 CEST

On Tuesday 26 August 2003 12:26 pm, Michael Wood wrote:

> > > Shouldn't that be "if new_key is None:"?
> >
> > Does it make any difference?
>
> Well, in general, "==" is not the same as "is".
>
> > I don't think it does.
>
> You're probably right.

"is" is more idiomatic when comparing with None, and
marginally faster. "x is None" and "x == None" aren't
quite equivalent, because x may be an object of a
user-defined class that redefines the behaviour of ==.
It isn't possible to redefine the behaviour of "is".
(That's one reason why using "is" will be faster.)

-- 
Gareth McCaughan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Aug 27 00:19:37 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.