[Python-ideas] import fallback syntax
Chris Withers
chris at simplistix.co.uk
Thu Mar 8 18:55:35 CET 2012
Hi All,
I see a lot of Python like this:
try:
from cDecimal import Decimal
except ImportError:
from decimal import Decimal
...and nest deeper if you're talking about ElementTree.
How about some syntactical sugar to make this less obnoxious:
from cDecimal or decimal import Decimal
from x.y.z import X as X or
a.b.z import Y as X or
what do people think?
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
More information about the Python-ideas
mailing list