1 | initial version |

If you just want to package several data items together and refer to them by a name rather than a numerical index (in which case you could use a list), you can use the python library `namedtuple`

:

http://docs.python.org/2/library/collections.html#collections.namedtuple

You'd end up with something like:

```
sage: from collections import namedtuple
sage: T=namedtuple('T',['scalar','M'])
sage: t=T(2.0,H)
sage: t
T(scalar=2.00000000000000, M=[s^2 + 10*s + 25 s])
sage: t.scalar
2.00000000000000
sage: t.M
[s^2 + 10*s + 25 s]
```

It's meant to be a variant of a `tuple`

so it's immutable (after creation you can't change the attributes). If you need that, you can just write your own class, as Niles points out.

You could also make it a dictionary if you don't mind referring to the field names by string:

```
sage: d=dict(scalar=2.0,M=H)
sage: d
{'M': [s^2 + 10*s + 25 s], 'scalar': 2.00000000000000}
sage: d['M']
[s^2 + 10*s + 25 s]
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.