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

Michel Desmoulin desmoulinmichel at gmail.com
Tue Feb 28 07:36:07 EST 2017



Le 28/02/2017 à 13:27, Markus Meskanen a écrit :
> Well you could just use a dict subclass here with get() that takes
> callable...
> 

As I said to Angelico:


Yes but this assumes:

- I have access to the code instantiating conf;
- all code using conf are using load_from_db as a default value;
- load_from_db exists for all code using the conf object

There is always a solution to all problems, as Python is turing complete.

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.


More information about the Python-ideas mailing list