earl / beanstalkc

A simple beanstalkd client library for Python
Apache License 2.0
457 stars 115 forks source link

Cannot use "with" syntax with beanstalkc.Connection #54

Closed mloccy closed 9 years ago

mloccy commented 10 years ago

Cannot do nice things like:

with beanstalkc.Connection(host='localhost', port=11300) as beanstalk:
    pass
    #Do stuff
svisser commented 10 years ago

+1 on this request. That being said, you can already do this with contextlib.closing:

import contextlib

with contextlib.closing(beanstalkc.Connection(host='localhost', port=11300)) as beanstalk:
    pass
earl commented 9 years ago

Implemtend in 87dc06dc7ebdefd4043e9e58cb69a086535bb38b.