dwave-cloud-client icon indicating copy to clipboard operation
dwave-cloud-client copied to clipboard

Event handler/processor as context manager

Open randomir opened this issue 4 years ago • 0 comments

Something like:

sampler = DWaveSampler()

with dwave.cloud.events.handle('before_sample', lambda event_name, obj, args: print(args)):
    sampler.sample(...)

sampler.sample(...)

would print the sampling args only for the first call to sample above.

randomir avatar Jan 22 '21 19:01 randomir