[Python-Dev] Syntax suggestion for imports (original) (raw)
Michael Urman murman at gmail.com
Thu Jan 3 07:56:51 CET 2008
- Previous message: [Python-Dev] Syntax suggestion for imports
- Next message: [Python-Dev] Syntax suggestion for imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 2, 2008 7:19 PM, Raymond Hettinger <python at rcn.com> wrote:
How about a new, simpler syntax:
* import threading or dummythreading as threading * import xml.etree.CElementTree or cElementTree or elementree.ElementTree as ET * from cStringIO or StringIO import StringIO * import readline or emptymodule
I'm sympathetic to this syntax proposal, as I find the repetition and extra lines for a simple idea to be a little unpleasant. This would also allow us to decide whether the import 'or' handling would be triggered equivalently to the except ImportError case you described, or only for missing imports. The latter would stop errors in existing modules from being silenced (and may give reason to allow emptymodule or None), but I'm unsure if that's a good thing.
Of the above I find the ElementTree migration to be the most compelling, yet it seems ill-timed to bring syntax into Python 2.x you'd be unable to use until you no longer needed it. However your later example of the PageTemplateFile, which appears to be due to a third-party module reorganization and could certainly happen during the lifetime of late 2.x, helps swing me back the other way.
-- Michael Urman
- Previous message: [Python-Dev] Syntax suggestion for imports
- Next message: [Python-Dev] Syntax suggestion for imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]