Re: [Python-ideas] lazy use for optional import

2017-03-02 Thread Chris Angelico
On Fri, Mar 3, 2017 at 10:10 AM, Abe Dillon wrote: > I really think the whole "lazy" idea is misguided. If it's possible for the > interpreter to determine automatically when it needs to force evaluation of > a lazy expression or statement, then why not make *all* expressions

Re: [Python-ideas] lazy use for optional import

2017-03-02 Thread Abe Dillon
I really think the whole "lazy" idea is misguided. If it's possible for the interpreter to determine automatically when it needs to force evaluation of a lazy expression or statement, then why not make *all* expressions and statements lazy by default? I think it's pretty clear when to force

Re: [Python-ideas] lazy use for optional import

2017-03-01 Thread Chris Barker
Going through machinations to satisfy PEP 8 makes no sense -- it's s style *guide* -- that's it. -CHB On Tue, Feb 28, 2017 at 3:31 PM, Nicolas Cellier < cont...@nicolas-cellier.net> wrote: > I have seen some interest into lazy functionality implementation. > > I wondered if it can be linked

Re: [Python-ideas] lazy use for optional import

2017-03-01 Thread Berker Peksağ
On Wed, Mar 1, 2017 at 2:31 AM, Nicolas Cellier wrote: > For example: > >> lazy import pylab as pl # do nothing for now >> >> # do stuff >> >> def plot(*args): >> pl.figure() # Will raise an ImportError at this point >> pl.plot(...) This can already be

[Python-ideas] lazy use for optional import

2017-02-28 Thread Nicolas Cellier
I have seen some interest into lazy functionality implementation. I wondered if it can be linked with optional import. PEP 8 authoritatively states: Imports are always put at the top of the file, just after any module comments and docstrings, and