Code review comment for lp:~soren/nova/libvirt-is-more-than-kvm-and-qemu

Revision history for this message
Soren Hansen (soren) wrote :

2011/3/17 Rick Harris <email address hidden>:
>> The reasoning was that I'm not just referencing it afterwards, I'm specifically indexing into it.
>> To ensure that that is a valid operation, it needs to have a non-zero length, not just be any value
>> that evaluates to True.
> Sure. Since you're indexing into the object, it's guaranteed to be a sequence. Sequences evaluate to truthy iff it has at least one element, so `if seq:` is just as safe as `if len(seq):`.

I think you're missing my point. I'm using len() to ensure it's
actually a sequence and not just something else that happens to
evaluate to True. Hmmm.. Come to think of it, I guess I'm screwed
either way. If it's not a sequence, len() will just blow up instead of
the attempt to index into it. /me fixes :)

--
Soren Hansen        | http://linux2go.dk/
Ubuntu Developer    | http://www.ubuntu.com/
OpenStack Developer | http://www.openstack.org/

« Back to merge proposal