Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60752

Re: how to implement a queue-like container with sort function

Date 2013-11-29 02:23 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: how to implement a queue-like container with sort function
References <b5e67d65-76a4-4a1a-87b4-70402c9bf865@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3391.1385691961.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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