| Home | Trees | Index | Help |
|
|---|
| Package picalo :: Package base :: Module Column :: Class Column |
|
object--+ |list--+ | Column
A single column of the table. Columns are not copies of the values in the table, but rather pointers to the actual table data. Therefore, changes to the values in the column are reflected in the underlying table.
Columns must have unique names from other columns in the table. Columns must also have either a column_type or an expression.
Columns extend Python lists and mimick the list interface. They can be used anywhere a regular Python list can.| Method Summary | |
|---|---|
Creates a Column. | |
__add__(self,
other)
| |
__and__(self,
other)
| |
Returns true if the item is in the column | |
__delitem__(self,
col)
| |
Compares this column with another column. | |
| object |
Retrieves the value of a field in the given record index. |
__iter__(self)
| |
| returns |
Count the number of records in the column. |
__or__(self,
other)
| |
For debugging | |
Sets a value in the column. | |
__sub__(self,
other)
| |
__xor__(self,
other)
| |
append(self,
*a,
**k)
| |
extend(self,
*a,
**k)
| |
Returns the format of this column. | |
Returns the type of this column. | |
| type |
Looks at a number of values in this column and tries to guess the type of the column. |
insert(self,
*a,
**k)
| |
pop(self,
*a,
**k)
| |
remove(self,
*a,
**k)
| |
reverse(self,
*a,
**k)
| |
Sets the format of this column. | |
Sets the name of this column to the given name | |
Sets the type of a column. | |
sort(self,
*a,
**k)
| |
Returns a column loader for this column (a representation of this column without ties to any table. | |
| Inherited from list | |
Use of negative indices is not supported. | |
x.__ge__(y) <==> x>=y | |
x.__getattribute__('name') <==> x.name | |
Use of negative indices is not supported. | |
x.__gt__(y) <==> x>y | |
x.__hash__() <==> hash(x) | |
x.__iadd__(y) <==> x+=y | |
x.__imul__(y) <==> x*=y | |
x.__le__(y) <==> x<=y | |
x.__lt__(y) <==> x<y | |
x.__mul__(n) <==> x*n | |
x.__ne__(y) <==> x!=y | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
L.__reversed__() -- return a reverse iterator over the list | |
x.__rmul__(n) <==> n*x | |
Use of negative indices is not supported. | |
L.count(value) -> integer -- return number of occurrences of value | |
L.index(value, [start, [stop]]) -> integer -- return first index of value | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Method Details |
|---|
__init__(self,
table,
name,
column_type=None,
expression=None,
format=None)
Creates a Column. Do not call this method directly. Rather, call
mytable["colname"]
|
__contains__(self,
item)
Returns true if the item is in the column
|
__eq__(self,
other)
Compares this column with another column. Everything must match
except the table the two columns are bound to
|
__getitem__(self,
recindex)
Retrieves the value of a field in the given record index.
|
__len__(self)
Count the number of records in the column.
|
__repr__(self)
For debugging
|
__setitem__(self,
recindex,
value)
Sets a value in the column. The value of this cell in the underlying
table is changed.
|
get_format(self)Returns the format of this column. If no format has been set, None is returned. |
get_type(self)Returns the type of this column. |
guess_type(self, num_records=-1)Looks at a number of values in this column and tries to guess the type of the column. Returns unicode if it can't guess the type since anything can be seen as a string. The method is conservative. It will only return a type if *all* values inspected are of the exact same type. It tries to convert values to types in the following order:
|
set_format(self, format=None)
Sets the format of this column. The format is used for printing the value
and showing the value in the Picalo GUI.
The format should be a Picalo expression that evaluates to a string. Use the
'value' variable for the value of the current cell.
Note that this is not an input mask. It doesn't affect the internal value of
the field values. It only affects how it is displayed on the screen.
Example:
# shows the current value in uppercase
table['Salary'].set_format("value.upper()")
@param format: A Picalo expression that evaluates to a string
@type format: str
|
set_name(self, name)Sets the name of this column to the given name |
set_type(self, column_type, format=None, expression=None)Sets the type of a column. The type must be a valid <type> object, such as int, float, str, unicode, DateTime, etc. All values in this column will be converted to this new type.
|
_get_columnloader(self)Returns a column loader for this column (a representation of this column without ties to any table. This is normally only used internally in Picalo. |
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Mon Aug 20 05:38:16 2007 | http://epydoc.sf.net |