A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-January/075842.html below:

[Python-Dev] Syntax suggestion for imports

[Python-Dev] Syntax suggestion for imports [Python-Dev] Syntax suggestion for importsToby Dickenson tdickenson at geminidataloggers.com
Fri Jan 4 11:27:04 CET 2008
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




More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4