[Python-3000] Useless methods in Queue module
charles.merriam at gmail.com
Mon Jan 14 22:32:13 CET 2008
Not to be pedantic, but the major concern others are voicing is that
is that queue size is not reliable and is therefore a potential source
of hard to find threading bugs by naive users. Why not just rename
q.size() to the unweildy name of q.est_size()?
On Jan 14, 2008 11:59 AM, Guido van Rossum <guido at python.org> wrote:
> Sounds like we have all-round agreement. Go for it.
> On Jan 14, 2008 11:55 AM, Raymond Hettinger <python at rcn.com> wrote:
> > > 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.
> > Raymond
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> Python-3000 mailing list
> Python-3000 at python.org
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/charles.merriam%40gmail.com
More information about the Python-3000