[Python-3000] Useless methods in Queue module

Raymond Hettinger python at rcn.com
Mon Jan 14 20:55:35 CET 2008

> I'm not sure people who ignore the big "Because of 
> multithreading semantics, this is not reliable" warnings 
> should be catered to. Since others have contributed use-cases
> for qsize()'s advisory information, it should probably stay around.

I concur.

I do recommend we dump q.empty() and q.full().  The right way is to trap the Empty and Full exceptions.  If needed qsize() is available to make your own less reliable checks.

More than just simplifying the API, the improvement makes it easier to roll your own Queue (like a priority queue style).  Currently, we require that six methods get overridden (_init, _empty, _full, _qsize, _put, and _get).  It would be nice to lower the burden to just the basic four.


More information about the Python-3000 mailing list