Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert vsc.utils.cache to use the with semantics. #39

Open
piojo-zz opened this issue Dec 9, 2012 · 0 comments
Open

Convert vsc.utils.cache to use the with semantics. #39

piojo-zz opened this issue Dec 9, 2012 · 0 comments

Comments

@piojo-zz
Copy link
Contributor

piojo-zz commented Dec 9, 2012

It is much simpler to use the FileCache module if we can do just like with any other file:

with vsc.utils.cache("foo") as f:
    f.load("some_key")
    # yabbadabba

Instead of

try:
    f = vsc.utils.cache("foo")
    try:
        f.load("some_key")
        # yabbadabba
    except Something, err:
        pass
    finally:
        pass
except SomethingElse, err2:
    pass

Our main users for this module are SL6 boxes, where the __enter__/__exit__ protocol is supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant