[pygobject] PEP8: Use isinstance() instead of direct type comparisons
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] PEP8: Use isinstance() instead of direct type comparisons
- Date: Fri, 22 Jun 2012 11:17:57 +0000 (UTC)
commit 129462ccc4a2191ecbb42247030c91bd0f1454f6
Author: Martin Pitt <martinpitt gnome org>
Date: Fri Jun 22 12:36:54 2012 +0200
PEP8: Use isinstance() instead of direct type comparisons
Spotted by current pep8 checker.
gi/overrides/GLib.py | 2 +-
gi/overrides/__init__.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index 2e8dc9c..95c46d9 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -87,7 +87,7 @@ class _VariantCreator(object):
format = format[1:] # eat the '('
builder = GLib.VariantBuilder.new(variant_type_from_string('r'))
if args is not None:
- if not args or type(args[0]) != type(()):
+ if not args or not isinstance(args[0], tuple):
raise TypeError('expected tuple argument')
for i in range(len(args[0])):
diff --git a/gi/overrides/__init__.py b/gi/overrides/__init__.py
index 10144e5..bdabb37 100644
--- a/gi/overrides/__init__.py
+++ b/gi/overrides/__init__.py
@@ -60,7 +60,7 @@ registry = _Registry()
def override(type_):
'''Decorator for registering an override'''
- if type(type_) == types.FunctionType:
+ if isinstance(type_, types.FunctionType):
return overridefunc(type_)
else:
registry.register(type_)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]