diff options
| author | lzyeval <lzyeval@gmail.com> | 2012-01-02 17:31:36 +0800 |
|---|---|---|
| committer | lzyeval <lzyeval@gmail.com> | 2012-01-03 11:12:42 +0800 |
| commit | ae1654bc5910dba5f02f49bc57a49442b9a5f8d6 (patch) | |
| tree | 8d591e12f7ea116f9860334adb1ee032533e1676 /nova/testing | |
| parent | ea21fe69655ae441eb9660e0579046355f6db4c1 (diff) | |
PEP8 remove direct type comparisons
Fixes bug #910763
According to PEP8,
- Object type comparisons should always use isinstance() instead
of comparing types directly.
Yes: if isinstance(obj, int):
No: if type(obj) is type(1):
When checking if an object is a string, keep in mind that it might be a
unicode string too! In Python 2.3, str and unicode have a common base
class, basestring, so you can do:
if isinstance(obj, basestring):
Change-Id: I7c0fdecf99872f5b8f72b2c2ed4f5c539c33def1
Diffstat (limited to 'nova/testing')
0 files changed, 0 insertions, 0 deletions
