From: Matt Wilson Subject: Re: pygrub patch to allow explicit offset to fs Date: Wed, 19 Jun 2013 11:10:33 -0700 Message-ID: <20130619181031.GA3014@u109add4315675089e695.ant.amazon.com> References: <51C0EFE5.10109@redpill-linpro.com> <1371629850.22783.58.camel@zakaz.uk.xensource.com> <20130619083954.GC2847@zion.uk.xensource.com> <1371631486.22783.72.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1371631486.22783.72.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Kjetil Torgrim Homme , George Dunlap , xen-devel@lists.xensource.com, Wei Liu List-Id: xen-devel@lists.xenproject.org On Wed, Jun 19, 2013 at 09:44:46AM +0100, Ian Campbell wrote: > On Wed, 2013-06-19 at 09:39 +0100, Wei Liu wrote: > > On Wed, Jun 19, 2013 at 09:17:30AM +0100, Ian Campbell wrote: > > > On Wed, 2013-06-19 at 01:40 +0200, Kjetil Torgrim Homme wrote: > > > > # get list of offsets into file which start partitions > > > > - part_offs = get_partition_offsets(file) > > > > + if user_provided_offset is None: > > > > + part_offs = get_partition_offsets(file) > > > > + else: > > > > + part_offs = [ int(user_provided_offset) ] > > > > > > Then this can become just: > > > if part_offs = None: > > > > You do know you missed a "=" here, right? :-) > > I claim pseudo-code ;-) Comparisons with None should be done with "is" and "is not". http://www.python.org/dev/peps/pep-0008/ Comparisons to singletons like None should always be done with is or is not, never the equality operators. Matt