[Python-checkins] cpython: Minor code cleanup.

raymond.hettinger python-checkins at python.org
Fri Nov 28 23:52:27 CET 2014


https://hg.python.org/cpython/rev/70163e18da87
changeset:   93652:70163e18da87
user:        Raymond Hettinger <python at rcn.com>
date:        Fri Nov 28 14:52:14 2014 -0800
summary:
  Minor code cleanup.

files:
  Lib/xml/etree/ElementPath.py |  5 +----
  1 files changed, 1 insertions(+), 4 deletions(-)


diff --git a/Lib/xml/etree/ElementPath.py b/Lib/xml/etree/ElementPath.py
--- a/Lib/xml/etree/ElementPath.py
+++ b/Lib/xml/etree/ElementPath.py
@@ -295,10 +295,7 @@
 # Find first matching object.
 
 def find(elem, path, namespaces=None):
-    try:
-        return next(iterfind(elem, path, namespaces))
-    except StopIteration:
-        return None
+    return next(iterfind(elem, path, namespaces), None)
 
 ##
 # Find all matching objects.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list