[PYTHON DB-SIG] database API
Fredrik Lundh
fredrik_lundh@ivab.se
Mon, 14 Oct 1996 11:32:56 +0200
Greg writes:
> "Established OO patterns" ?? Excuse me, but I've been doing this
> stuff for a long time. I've never noticed any particular pattern.
> Python does not use iterators; therefore, introducing them is not a
> very Python-ish concept. Instead, Python iterates over a list using
> the "for" statement.
/.../
> Jim Fulton has suggested that the cursor object should respond to
> __getitem__ so it can be directly used in a for loop.
Which is exactly what at least I would call an iterator :-)
>From Design Patterns [GOF 1994]: "Iterator -- provide a way to access
the elements of an aggregate object sequencially without exposing its
underlying representation."
Cheers /F
=================
DB-SIG - SIG on Tabular Databases in Python
send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
=================