Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60754
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'detect': 0.07; 'override': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'thread': 0.14; 'container,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subclass': 0.16; 'threads,': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'header:User-Agent:1': 0.23; 'module,': 0.24; 'subject:like': 0.24; 'sort': 0.25; 'order.': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'fixed': 0.29; "doesn't": 0.30; 'reaches': 0.30; 'container': 0.31; 'yields': 0.31; 'subject:with': 0.35; 'add': 0.35; 'there': 0.35; 'method': 0.36; 'similar': 0.36; 'should': 0.36; 'list': 0.37; 'implement': 0.38; 'checks': 0.38; 'to:addr :python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'length': 0.61; 'subject: ': 0.61; 'new': 0.61; 'numbers': 0.61; 'received:173': 0.61; 'such': 0.63; 'received:fios.verizon.net': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: how to implement a queue-like container with sort function |
| Date | Thu, 28 Nov 2013 21:31:36 -0500 |
| References | <b5e67d65-76a4-4a1a-87b4-70402c9bf865@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
| In-Reply-To | <b5e67d65-76a4-4a1a-87b4-70402c9bf865@googlegroups.com> |
| 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.3392.1385692320.18130.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1385692320 news.xs4all.nl 15907 [2001:888:2000:d::a6]:33900 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:60754 |
Show key headers only | View raw
On 11/28/2013 8:54 PM, iMath wrote: > I want to a fixed length list-like container, it should have a sorted()-like function that I can use to sort it,I think there should also a function I can use it to detect whether the numbers of items in it reaches the length of the container , because if the numbers of items in it reaches the length(fixed) of the container,I want to process the data in it .Is there a container in Python like this ?If not, what base container should be used to implement such container? > > the container is similar to queue ,but queue doesn't have a sort function For single thread use, subclass list, add a new .put method that checks the list size and either does self.append or self.sort(); process(list). For multiple threads, you need the queue module, which has extra features (and baggage). A PriorityQueue yields items in sorted order. Subclass it and override .put to either call the original .put or start a process thread. -- Terry Jan Reedy
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