En Sat, 10 Mar 2007 01:23:11 -0300, Paulo da Silva
<[EMAIL PROTECTED]> escribió:
> Gabriel Genellina escreveu:
>
>> Just omit the __init__ method, if you don't have anything additional to
>> do. The inherited method will be used instead, as always:
>
>
> Then, if I have something additional, I c
Gabriel Genellina escreveu:
...
> Just omit the __init__ method, if you don't have anything additional to
> do. The inherited method will be used instead, as always:
Then, if I have something additional, I can do
def __init__(self,l=None):
if l!=None:
En Fri, 09 Mar 2007 23:45:50 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> On Fri, 09 Mar 2007 18:57:42 -0300, Gabriel Genellina wrote:
>
>> En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva
>> <[EMAIL PROTECTED]> escribió:
>>
>>> What is the best way to have something like the bisect_
On Fri, 09 Mar 2007 18:57:42 -0300, Gabriel Genellina wrote:
> En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva
> <[EMAIL PROTECTED]> escribió:
>
>> What is the best way to have something like the bisect_left
>> method on a list of lists being the comparision based on an
>> specified arbitrar
En Fri, 09 Mar 2007 21:25:24 -0300, Paulo da Silva
<[EMAIL PROTECTED]> escribió:
> Thanks Gabriel. This sounds very nice for my purpose.
> I have some doubts however. How do I "transform" a list into
> MyList? Is this the best way?
>
> class MyList(list):
> def __init__(self,l=None):
>
Gabriel Genellina escreveu:
> En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva
> <[EMAIL PROTECTED]> escribió:
...
>
> lists *are* classes (at least since Python 2.2)
> Inherit from the builtin list, redefine __cmp__(self, other) as
...
Thanks Gabriel. This sounds very nice for my purpose.
I h
Paulo da Silva wrote:
> What is the best way to have something like the bisect_left
> method on a list of lists being the comparision based on an
> specified arbitrary i_th element of each list element?
A simple way that leaves the lists untouched:
>>> import bisect, random
>>> from operator imp
Paulo da Silva:
> What is the best way to have something like the bisect_left
> method on a list of lists being the comparision based on an
> specified arbitrary i_th element of each list element?
You may use this recipe of mine that I've just put there for you, but
it's not fully tested yet (if y
En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva
<[EMAIL PROTECTED]> escribió:
> What is the best way to have something like the bisect_left
> method on a list of lists being the comparision based on an
> specified arbitrary i_th element of each list element?
>
> Is there, for lists, something
Hi!
What is the best way to have something like the bisect_left
method on a list of lists being the comparision based on an
specified arbitrary i_th element of each list element?
Is there, for lists, something equivalent to the __cmp__ function for
classes?
Thanks.
--
http://mail.python.org/mai
10 matches
Mail list logo