-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Oct 22, 2007, at 11:30 PM, [EMAIL PROTECTED] wrote:
> It's not clear that any of these implementations is going to be > perfect. > Maybe none ever will be. I would agree with this. You write a program and know you need to implement some kind of resource locking, so you start looking for some OTS solution. But then you realize that your application needs somewhat different semantics or needs to work in platforms or environments that the OTS code doesn't handle. Just a few days ago, I was looking at some locking code that needed to work across multiple invocations of a script on multiple machines, and the only thing they shared was a PostgreSQL connection, so we ended up wanting to use its advisory locks. > In his reply Jean-Paul made this comment: > > It might be nice to have something like that in the standard > library, > but it's very simple once you know what to do. > > I'm not so sure about the "very simple" part, especially if you aren't > familiar with all the ins and outs of the different platforms. I'd totally agree with this. Locking seems simple, but it's got some really tricky aspects that need to be coded just right or you'll be in a world of hurt. Mailman's LockFile.py (which you're right is *nix only) is stable now, but has had some really subtle bugs in the past. > The fact > that the first three bits of code I was referred to were > implemented by > three significant Python tools/platforms and that all are different > in some > significant ways suggests that there is some both an underlying > need for a > file locking mechanism but with a lack of consensus about the best > way to > implement the mother-of-all-file-locking schemes for Python. Maybe > the best > place for this is in the distribution. PEP? I don't think any one solution will work for everybody. I'm not even sure we can define a common API a la the DBAPI, but if something were to make it into the standard distribution, that's the direction I'd go in. Then we can provide various implementations that support the LockingAPI under various environments, constraints, and platforms. If we wanted to distribute them in the stdlib, we could put them all in a package and let the user decide which features they need. I'm still planning on de-Mailman-ifying LockFile.py sometime soon. - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iQCVAwUBRyFh4XEjvBPtnXfVAQIAgwQAk0Hf8df6zVGE0sMEfDGFqw6U5/w4TN07 Wiw4Gxq5mRh7jUGoscMrs7L0mjppC/yrv0xIey0u3uQAZqGKLvK2LRBSdC6vyaGY v9ExnI+q59ffe3oL6UTAmuiouTZspYxSv88wl6ATIPpK0SveAzlwu1c2Xnmw1MaR 5m0Mp+VUR9Q= =6FrA -----END PGP SIGNATURE----- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com