Permalink
Browse files

conditional import of cElementTree

  • Loading branch information...
1 parent e468ed8 commit fbe7f3dccb05e96fed50457a52d992d548dac36a @stevenbird stevenbird committed Mar 21, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 nltk/internals.py
View
4 nltk/internals.py
@@ -17,7 +17,9 @@
import sys
import stat
-from xml.etree import cElementTree as ElementTree
+# Use the c version of ElementTree, which is faster, if possible:
+try: from xml.etree import cElementTree as ElementTree
+except ImportError: from xml.etree import ElementTree
from nltk import __file__

0 comments on commit fbe7f3d

Please sign in to comment.