Re: python bisect questions

2008-04-04 Thread Gabriel Genellina
En Fri, 04 Apr 2008 18:08:57 -0300, <[EMAIL PROTECTED]> escribió: >> b) Define a function to extract a "key" from your items such that items >>   >> compare the same as their keys. For example, key(x) -> x.lower() may be >>   >> used to compare text case-insensitively. >> Then, use a tuple (ke

Re: python bisect questions

2008-04-04 Thread ankitks . mital
> > b) Define a function to extract a "key" from your items such that items   > compare the same as their keys. For example, key(x) -> x.lower() may be   > used to compare text case-insensitively. > Then, use a tuple (key, value) instead of the bare value. When extracting   > items from the queue,

Re: python bisect questions

2008-04-03 Thread ankitks . mital
Thanks Gabriel -- http://mail.python.org/mailman/listinfo/python-list

Re: python bisect questions

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 19:21:19 -0300, <[EMAIL PROTECTED]> escribió: > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: >> <[EMAIL PROTECTED]> wrote in message >> >> news:[EMAIL PROTECTED] >> |I am week on functional programming, and having hard time >> | understanding this: >> | >> | clas

Re: python bisect questions

2008-04-03 Thread ankitks . mital
On Apr 3, 5:43 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Apr 4, 9:21 am, [EMAIL PROTECTED] wrote: > > > > > > > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > > <[EMAIL PROTECTED]> wrote in message > > > >news:[EMAIL PROTECTED] > > > |I am week on functional programming, an

Re: python bisect questions

2008-04-03 Thread John Machin
On Apr 4, 9:21 am, [EMAIL PROTECTED] wrote: > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > > > > > > > <[EMAIL PROTECTED]> wrote in message > > >news:[EMAIL PROTECTED] > > |I am week on functional programming, and having hard time > > | understanding this: > > | > > | class myP

Re: python bisect questions

2008-04-03 Thread ankitks . mital
On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |I am week on functional programming, and having hard time > | understanding this: > | > | class myPriorityQueue: > |      def __init__(self, f=lamda x:x): > |            

Re: python bisect questions

2008-04-03 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I am week on functional programming, and having hard time | understanding this: | | class myPriorityQueue: | def __init__(self, f=lamda x:x): | self.A = [] | self.f = f | | def append(self, item) |

python bisect questions

2008-04-03 Thread ankitks . mital
I am week on functional programming, and having hard time understanding this: class myPriorityQueue: def __init__(self, f=lamda x:x): self.A = [] self.f = f def append(self, item) bisect.insort(self.A, (self.f(item), item)) n