[Python-3000] Useless methods in Queue module

Thomas Heller theller at ctypes.org
Fri Jan 11 21:01:31 CET 2008


Raymond Hettinger schrieb:
> I proposed to remove three methods from the queue module, qsize(),
> empty(), and full().  These are not reliable.  The RightWay (tm) is
> to trap the Empty and Full exceptions or use the .join() approach.

I am actively using empty().  This code example receives and processes requests
into a database, and does a commit when there is nothing to do.  It can
certainly be written in a different way, but I'm happy with it:

            while 1:
                if self.queue.empty():
                    database.commit()
                request = self.queue.get()
                database.process(request)


Please keep them.

Thomas



More information about the Python-3000 mailing list