Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60862
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.051 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.01; 'wrapper': 0.09; 'cc:addr :python-list': 0.11; 'attribute:': 0.16; 'deque': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'skipping': 0.16; 'wrote:': 0.18; 'meant': 0.20; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'adds': 0.24; "shouldn't": 0.24; 'subject:like': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'directly,': 0.31; 'noticed': 0.34; 'could': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'needed': 0.38; 'pm,': 0.38; 'that,': 0.38; 'first': 0.61; 'batchelder': 0.84; 'mistakenly': 0.91; 'to:none': 0.92; 'directly.': 0.95; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Vf8KwJn9PyHKjiNZlL1rnn2ALd5spYDhCnYzhxuov3Y=; b=t/mOpdroz2anXG9Kevexq4Qfv3HeBH60qbbi+JDN2FwNOSBVQ/um0dT7mcaZqyA2vb DxuN1L92Wy+WOen5i4hjgYlkabFRAG+ktRIQKahyvzIgbqBy299mdpP3lTgUTFzTynl6 nQzwTIswBjMwIxSphsG0y1WD3/EUC/Zn33xNmzfKPgFwsfNeBaqJJ/ykAp7G3Sco0FwK /WTzICND1OvXVhfuq/974TxghSUMW3NZ5MjiyK1Ykm9zpTgFsy4nLNx2YkApKljwWw6S RDV8Q3iIHadV7h/i/6Bp0V2sRtW5PCDn3XOeaLTBKHgCN+fmxxRLQBG+B0TdLo3wKExo f32Q== |
| MIME-Version | 1.0 |
| X-Received | by 10.66.65.134 with SMTP id x6mr3407885pas.142.1385985891118; Mon, 02 Dec 2013 04:04:51 -0800 (PST) |
| In-Reply-To | <l7hsk6$n25$1@ger.gmane.org> |
| References | <b5e67d65-76a4-4a1a-87b4-70402c9bf865@googlegroups.com> <0c445e44-25c7-42b9-8c62-c30428261251@googlegroups.com> <mailman.3400.1385737072.18130.python-list@python.org> <39b48b0b-5c0a-42d9-922f-27987386764b@googlegroups.com> <l7hsk6$n25$1@ger.gmane.org> |
| Date | Mon, 2 Dec 2013 23:04:51 +1100 |
| Subject | Re: how to implement a queue-like container with sort function |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3459.1385985899.18130.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1385985900 news.xs4all.nl 15991 [2001:888:2000:d::a6]:35318 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:60862 |
Show key headers only | View raw
On Mon, Dec 2, 2013 at 10:58 PM, Ned Batchelder <ned@nedbatchelder.com> wrote: > Yes, a Queue object has a queue attribute: > > >>> import Queue > >>> q = Queue.Queue() > >>> q.queue > deque([]) > > But you shouldn't use it. It's part of the implementation of Queue, not > meant for you to use directly. In particular, if you use it directly, you > are skipping all synchronization, which is the main reason to use a Queue in > the first place. I should apologize here; when the OP said "queue", I immediately noticed that I could import that and use it, and mistakenly started my testing on that, instead of using the deque type. It's deque that should be used here. Queue is just a wrapper around deque that adds functionality that has nothing to do with what's needed here. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to implement a queue-like container with sort function iMath <redstone-cold@163.com> - 2013-11-28 17:54 -0800
Re: how to implement a queue-like container with sort function Chris Angelico <rosuav@gmail.com> - 2013-11-29 13:03 +1100
Re: how to implement a queue-like container with sort function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-29 03:32 +0000
Re: how to implement a queue-like container with sort function iMath <redstone-cold@163.com> - 2013-11-28 18:04 -0800
Re: how to implement a queue-like container with sort function Chris Angelico <rosuav@gmail.com> - 2013-11-29 13:06 +1100
Re: how to implement a queue-like container with sort function iMath <redstone-cold@163.com> - 2013-11-28 18:32 -0800
Re: how to implement a queue-like container with sort function Cameron Simpson <cs@zip.com.au> - 2013-11-29 17:19 +1100
Re: how to implement a queue-like container with sort function MRAB <python@mrabarnett.plus.com> - 2013-11-29 02:23 +0000
Re: how to implement a queue-like container with sort function Terry Reedy <tjreedy@udel.edu> - 2013-11-28 21:31 -0500
Re: how to implement a queue-like container with sort function Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-11-29 17:53 +1300
Re: how to implement a queue-like container with sort function iMath <redstone-cold@163.com> - 2013-11-29 04:33 -0800
Re: how to implement a queue-like container with sort function Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-29 14:57 +0000
Re: how to implement a queue-like container with sort function iMath <redstone-cold@163.com> - 2013-12-02 03:41 -0800
Re: how to implement a queue-like container with sort function Ned Batchelder <ned@nedbatchelder.com> - 2013-12-02 06:58 -0500
Re: how to implement a queue-like container with sort function Chris Angelico <rosuav@gmail.com> - 2013-12-02 23:04 +1100
Re: how to implement a queue-like container with sort function Ned Batchelder <ned@nedbatchelder.com> - 2013-12-02 07:26 -0500
csiph-web