[Python-ideas] Another use case for the 'lazy' (aka 'delayed') keyword

Markus Meskanen markusmeskanen at gmail.com
Tue Feb 28 07:47:09 EST 2017


>
> You don't need list comprehension, you can use a for loop.
>
> You don't need upacking you can use indexing.
>
> And you don't need lazy, it's just convenient.
>

With this sole argument you can add almost anything to the language as long
as it has at least one use case where it's better than existing tools. I'm
not against the lazy proposal in general, but attempting to justify a new
keyword to replace this is just silly to me:

class Config(dict):
    def lazy_get(self, key, callable=None):
        if key in self:
            return self[key]
        return callable(key)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170228/9309a70b/attachment.html>


More information about the Python-ideas mailing list