On Mon, 03 Mar 2008 12:17:39 +0100, M.-A. Lemburg wrote:
> It's also possible to implement .__getitem__() and .__len__()
> methods and have Python create an iterator on-the-fly. That's
> how Python used to work before iterators were added to the
> language.
A suitable `__getitem__()` is enough.
On 2008-03-02 15:06, Preben Randhol wrote:
> Hi
>
> I'm making a kind of ordered dictionary class. It is not exactly a
> dictionary, but it uses a list and dictionary to store the data.
>
> Something like:
>
> class dbase(list):
> '''Database class keeping track of the order and dat
On Sun, 2 Mar 2008 06:15:54 -0800 (PST)
Giles Brown <[EMAIL PROTECTED]> wrote:
> http://docs.python.org/lib/typeiter.html
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 2 Mar 2008 08:09:24 -0800 (PST)
[EMAIL PROTECTED] wrote:
> On Mar 2, 8:15 am, Giles Brown <[EMAIL PROTECTED]> wrote:
> > http://docs.python.org/lib/typeiter.html
>
> Be careful on your descision to return an ordered iterator or not--
> that is, whether it iterates over the dictionary or
On Mar 2, 8:15 am, Giles Brown <[EMAIL PROTECTED]> wrote:
> On Mar 2, 2:08 pm, Preben Randhol
> [EMAIL PROTECTED]> wrote:
> > On Sun, 2 Mar 2008 15:06:17 +0100
>
> > Preben Randhol <[EMAIL PROTECTED]> wrote:
> > > class dbase(list):
>
> > Sorry the definition of the class is:
>
> > clas
On Mar 2, 2:08 pm, Preben Randhol wrote:
> On Sun, 2 Mar 2008 15:06:17 +0100
>
> Preben Randhol <[EMAIL PROTECTED]> wrote:
> >class dbase(list):
>
> Sorry the definition of the class is:
>
> class dbase(object):
>
> it doesn't derive from the list class.
>
> Preben
http://docs.python.
On Sun, 2 Mar 2008 15:06:17 +0100
Preben Randhol <[EMAIL PROTECTED]> wrote:
> class dbase(list):
Sorry the definition of the class is:
class dbase(object):
it doesn't derive from the list class.
Preben
--
http://mail.python.org/mailman/listinfo/python-list
Hi
I'm making a kind of ordered dictionary class. It is not exactly a
dictionary, but it uses a list and dictionary to store the data.
Something like:
class dbase(list):
'''Database class keeping track of the order and data'''
def __init__(self):
self.__