d3py icon indicating copy to clipboard operation
d3py copied to clipboard

del statement fails to clean up files

Open mikedewar opened this issue 13 years ago • 2 comments

(Problem exposed while dealing with pull #25)

del is not what we want to cleanup files: the reference count could be at zero even if we have stale files lying around!

One solution would be to use enter and exit and require the user to create a figure object with the with statement:

with Figure() as fig: ...do stuff with fig...

ideas?

mikedewar avatar Feb 16 '12 12:02 mikedewar

I like using with! Shouldn't change the use case much... Let me write some wiki pages exploring the idiom...

mikedewar avatar Feb 16 '12 12:02 mikedewar

I agree! I was going to implement it, but realized it still was quite a shift from the way things are done now. It would solve the problem quite well (intact, that's why the with statement was made!)

mynameisfiber avatar Feb 16 '12 14:02 mynameisfiber