[Python-Dev] Syntax suggestion for imports (original) (raw)
Toby Dickenson tdickenson at geminidataloggers.com
Fri Jan 4 11:27:04 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 ]
Raymond Hettinger wrote:
[Jeroen Ruigrok van der Werven]
On the Trac project using your grep gives me 203 lines, if we take ~2 lines for and after in consideration, it still means 203/5 ~= 40 occurences. Thanks. I'm more curious about the content of those lines. Does the proposed syntax help, does the need go away in Py3.0, what is the typical pattern?
I dont think I would use this based on a survey of 16 cases over 35k lines here.....
The proposed syntax could be easily used 11 times. 10 of those are the 'or None' variant and account for platform-specific modules. 2 of those currently issue a warning about the missing module in the exception branch, but I guess I could live without that.
Two other cases uses a different fallback value other than None; one a string literal, and the other 'object'.
The remaining three cases do not really fit the proposed syntax. They are currently in the form: try: import xxx except ImportError: recovery actions else: do something with xxx
- Previous message: [Python-Dev] Syntax suggestion for imports
- Next message: [Python-Dev] Syntax suggestion for imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]