Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'python.': 0.02; 'detect': 0.07; 'python': 0.11; 'container,': 0.16; 'container.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'header:User-Agent:1': 0.23; 'subject:like': 0.24; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'fixed': 0.29; "doesn't": 0.30; 'reaches': 0.30; 'container': 0.31; 'subject:with': 0.35; 'classes': 0.35; 'received:84': 0.35; 'there': 0.35; 'similar': 0.36; 'should': 0.36; 'list': 0.37; 'implement': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'to:addr:python.org': 0.39; 'length': 0.61; 'subject: ': 0.61; 'numbers': 0.61; 'such': 0.63; 'header:Reply- To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'reply- to:addr:python.org': 0.84; 'have.': 0.93 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=IvYnLtPg c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=OJn0C7AadrgA:10 a=SrBxplfS2hYA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=i8wGUEO_q4UA:10 a=KJwhNqj8D6ETxoi2jrwA:9 a=Vu5AQTvZIbvLvGWb:21 a=f_96mXSR7D1e-R5c:21 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Fri, 29 Nov 2013 02:23:12 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: how to implement a queue-like container with sort function References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385691961 news.xs4all.nl 15863 [2001:888:2000:d::a6]:57888 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60752 On 29/11/2013 01:54, 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 > This is Python. You don't have to base it on an existing container. Write a list of the methods it should have. If none of the existing classes seem suitable as a superclass, then don't bother, just write it from scratch. You can always use an existing container, such as a list, as part of its implementation.