Re: Request for comments: use-cases for delayed evaluation

2018-05-18 Thread dieter
Steven D'Aprano writes: > Suppose Python had a mechanism to delay the evaluation of expressions > until needed. What would you use it for? Delayed evaluation is some form of "lazy evaluation": evaluate an expression (only) at the time, it is needed (maybe

RE: Request for comments: use-cases for delayed evaluation

2018-05-17 Thread Dan Strohl via Python-list
I could easily see using all of the examples; I run into this pretty regularly. What about something like the following (which, honestly is really a combination of other examples). If I have a function that has multiple parameters, each of which might be expensive, but it might break out

Request for comments: use-cases for delayed evaluation

2018-05-17 Thread Steven D'Aprano
Suppose Python had a mechanism to delay the evaluation of expressions until needed. What would you use it for? Python already does this on an ad hoc basis. For example, the "and" and "or" operators are special: and If the expression on the left is falsey, the expression on the right is