Package lemon :: Package external :: Module dtuple :: Class TupleDescriptor
[show private | hide private]
[frames | no frames]

Class TupleDescriptor


Describes a return tuple from a DB-API fetch*() method.

Instances of this class are used to describe database tuples (which are
typically instances of DatabaseTuple or one of its derivative classes).
These instances specify the column names, formats, lengths, and other
relevant information about the items in a particular tuple. An instance
is typically shared between many database tuples (such as those returned
by a single query).

Note: the term database tuple is rather specific; in actuality the tuple
may have come from non-database sources and/or generated by a process
wholly unrelated to databases.

Note again: I'm open for new names for this and the DatabaseTuple class
and concept :-)

Method Summary
  __init__(self, desc)
TupleDescriptor constructor.
  __len__(self)
Returns the number of elements in the data object.
  __repr__(self)
  __str__(self)

Method Details

__init__(self, desc)
(Constructor)

TupleDescriptor constructor.

An instance is created by passing a "descriptor" to fully specify the
information about the related database tuple. This descriptor takes the
form of a tuple or list where each element is a tuple. The first element
of this tuple is the name of the column. The following elements of the
tuple are used to describe the column (such as length, format,
significant
digits, etc).

__len__(self)
(Length operator)

Returns the number of elements in the data object.

A tuple descriptor responds to __len__ to simplify some processing by
allowing the use of the len() builtin function.

Generated by Epydoc 2.0 on Mon Nov 10 15:08:04 2003 http://epydoc.sf.net