[Python-ideas] Lock-File class: FileLock

Mathias Panzenböck grosser.meister.morti at gmx.net
Mon Nov 17 20:14:46 CET 2008


Hi.

Maybe I'm just blind and can't find it, but it seems that python has no file
based lock. I wrote one using fcntl (mscvrt on windows):

http://twoday.tuwien.ac.at/pub/stories/319462/

I think this would be a nice addition to pythons standard library.

I called the lock/unlock methods, well, lock and unlock (and there is a trylock
method, too). I just now saw the methods of threading.Lock are called acquire
and release. Shall I change the method names? (a matter of s/\<lock\>/acquire/g
s/\<unlock\>/release/g s/\<trylock\>/tryacquire/g) I will change it if it gets
included to python that way.
I like lock/unlock more, though.

	-panzi



More information about the Python-ideas mailing list