diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-25 07:00:41 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-25 07:00:41 +0000 |
commit | d0229a920129155f9a9b423db0ed33870a27c1d1 (patch) | |
tree | 7d99c0baf3d9cc8acb871565d6b25f49e7764f75 | |
parent | 8f7d6cd85e68af46648ff93bf846ba95abf7dcee (diff) | |
download | portage-d0229a920129155f9a9b423db0ed33870a27c1d1.tar.gz portage-d0229a920129155f9a9b423db0ed33870a27c1d1.tar.bz2 portage-d0229a920129155f9a9b423db0ed33870a27c1d1.zip |
Remove ugly code from __len__, since defining __bool__ fixes the same
issue.
svn path=/main/trunk/; revision=14428
-rw-r--r-- | pym/portage/proxy/objectproxy.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/pym/portage/proxy/objectproxy.py b/pym/portage/proxy/objectproxy.py index dff4a07f7..a064d7056 100644 --- a/pym/portage/proxy/objectproxy.py +++ b/pym/portage/proxy/objectproxy.py @@ -47,15 +47,7 @@ class ObjectProxy(object): return iter(object.__getattribute__(self, '_get_target')()) def __len__(self): - try: - return len(object.__getattribute__(self, '_get_target')()) - except TypeError: - # For python 3.x with boolean target, len() results in - # TypeError, so return 0 or 1. - if bool(object.__getattribute__(self, '_get_target')()): - return 1 - else: - return 0 + return len(object.__getattribute__(self, '_get_target')()) def __repr__(self): return repr(object.__getattribute__(self, '_get_target')()) |