next up previous contents
Next: Retrieving data Up: Datasets Previous: The first step   Contents

Naming a Dataset

A plain, old dataset object is good, but it might be nice to give it a name that is a little more descriptive and just the variable name ds. To manipulate the name of a dataset we use a pair of methods - getName() and setName(). Try the following sequence of commands.

>>> ds.getName()
>>> print ds.getName()
None
>>> ds.setName('My First Dataset')
>>> ds.getName()
'My First Dataset'
>>> print ds.getName()
My First Dataset

Notice that unless we specified print, no name was printed after executing getName(). This is because the python print command prints a string representation of a python variable. By itself, None has nothing to show, but its string representation is the literal string 'None'. Compare this to the output of getName() after setting the object's name to 'My First Dataset'. Can you see the parallel?



Lucas Scharenbroich 2003-08-27