Craig Yoshioka wrote:
>It is a bit non-normal. but I think this is a good use case as I want to
>create a very simple-to-use system for non-python experts to safely wrap their
>CLI programs in a caching architecture... that's why I lament the inability to
>not use the more streamlined 'with' sy
It is a bit non-normal. but I think this is a good use case as I want to
create a very simple-to-use system for non-python experts to safely wrap their
CLI programs in a caching architecture... that's why I lament the inability to
not use the more streamlined 'with' syntax– abusing the for loo
On 2/28/2012 5:12 PM, Prasad, Ramit wrote:
Craig Yoshioka wrote:
I see that there was previously a PEP to allow the with statement to skip the
enclosing block... this was shot down, and I'm trying to think of the most
elegant alternative. [..]
I would have really liked:
with cachingcontext(
On Tue, Feb 28, 2012 at 1:04 PM, Craig Yoshioka wrote:
>
> I see that there was previously a PEP to allow the with statement to skip the
> enclosing block... this was shot down, and I'm trying to think of the most
> elegant alternative.
> The best I've found is to abuse the for notation:
>
> for
Craig Yoshioka wrote:
>I see that there was previously a PEP to allow the with statement to skip the
>enclosing block... this was shot down, and I'm trying to think of the most
>elegant alternative. [..]
>I would have really liked:
>with cachingcontext(x):
># create cached resources here
>#
I see that there was previously a PEP to allow the with statement to skip the
enclosing block... this was shot down, and I'm trying to think of the most
elegant alternative.
The best I've found is to abuse the for notation:
for _ in cachingcontext(x):
# create cached resources here
# return