[Python-ideas] "maybe import"?

Philipp A. flying-sheep at web.de
Fri Dec 27 09:36:03 CET 2013


agreed. and the try/except pattern also allows for

try:
    import thing
except ImportError:
    import slower_thing_with_same_api as thing


2013/12/27 Guido van Rossum <guido at python.org>

> We shouldn't encourage optional dependencies. They often make code harder
> to reason about or harder to read.
>
>
> On Thursday, December 26, 2013, Amber Yust wrote:
>
>>  On Thu Dec 26 2013 at 8:57:42 PM, Gregory P. Smith <greg at krypto.org>
>> wrote:
>> > Such idioms are common.  Though I don't think we should encourage their
>> use.
>>
>> Is this a case of "we shouldn't encourage optional dependencies" or "we
>> shouldn't encourage this kind of idiom as a means of implementing optional
>> dependencies" - and if the latter, what alternative would you point people
>> at instead?
>>
>
>
> --
> --Guido van Rossum (on iPad)
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131227/05de5022/attachment-0001.html>


More information about the Python-ideas mailing list