[Python-ideas] Idea: Lazy ... statement
grosser.meister.morti at gmx.net
Tue Oct 14 22:39:56 CEST 2008
Jim Jewett schrieb:
> On Mon, Oct 13, 2008 at 4:12 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>> So I think it would be good to have a dedicated syntax
>> for lazy imports, so the top-level foo package can say
>> something like
>> from foo.thing lazily import Thing
>> from foo.stuff lazily import Stuff
> Since this can be (awkwardly) done now, I don't think the problem is
> big enough for another keyword. On the other hand, a "lazy" keyword
> that worked in other contexts might have some merit.
> That would solve at least one major objection to setdefault-style functions.
> def setdefault(self, k, lazy d=None): ...
> or even
> lazy def yikes(msg):
> """Something went very wrong; report for debugging"""
> import logging
> ...logging config setup...
> Note that I'm not yet ready to volunteer on fleshing out the details,
> let alone how to implement it efficiently. (Would it require the
> moral equivalent of quasiquoting?)
I don't understand what this lazy keyword should do?
More information about the Python-ideas