Updating python-debian support for build profiles

John Wright jsw at debian.org
Sat Sep 6 07:23:37 UTC 2014


Hi Stuart,

On Fri, Sep 05, 2014 at 12:46:28AM +1000, Stuart Prescott wrote:
> > >              if dep.get('version') is not None:
> > Optional, while you're here, might make sense to either:
> >   - Use the more idiomatic form: 'version' not in dep
> >   - Or save the result of dep.get('version') instead of looking it up
> >     twice.
> 
> There are cases where the dep['version'] exists but is None and the subsequent 
> code needs protecting from that None, so it would be 
> 
> -              if dep.get('version') is not None:
> +             if 'version' in dep and dep['version']:
> 
> It gets rid of an ugly looking ".get()" but is it really an improvement?

Missed that, sorry.  It might still make sense to save the value rather
than looking it up twice, e.g.

  version = dep.get('version')
  if version is not None:
      # ...

I leave it up to you.

> > > +                                [(False, 'profile', 'stage1')],
> > 
> > Weird, these are equal even though one is a raw tuple and one is a
> > namedtuple type?
> 
> yeah... I don't know what sort of comparison assertEqual is doing here -- I 
> assume that it just gets passed to the tuple tester.

Acknowledged.  Equality doesn't always imply type-equality, it just
surprised me that it didn't in this case.

-- 
John Wright <jsw at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20140906/cd4c097d/attachment.sig>


More information about the pkg-python-debian-maint mailing list