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 <[email protected]>
signature.asc
Description: Digital signature
-- http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-python-debian-maint
