Commit debfa3b5 authored by Vincent Pelletier's avatar Vincent Pelletier

Use isinstance instead of type() equalities.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16172 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5558feea
...@@ -101,9 +101,9 @@ def asList(value): ...@@ -101,9 +101,9 @@ def asList(value):
""" """
Return the value as a list or a type-specific default value if it fails. Return the value as a list or a type-specific default value if it fails.
""" """
if type(value) in (type([]), type(())): if isinstance(value, (list, tuple)):
result = list(value) result = list(value)
elif type(value) is type('a'): elif isinstance(value, str):
result = value.split() result = value.split()
else: else:
result = [value] result = [value]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment