1 | initial version |

As you know, `instance`

is a given case, a given version, of a `class`

. When `parent`

returns `instance`

, that simply means that there's nothing particularly Sage-specific about the structure and it's not living within Sage's Category structure.

```
sage: class fred: pass
....:
sage: parent(fred)
<type 'classobj'>
sage: a = fred()
sage: parent(a)
<type 'instance'>
```

which is why we have

```
sage: f(x) = x^2
sage: parent(f)
Callable function ring with arguments (x,)
sage: g = Piecewise([[(0,1),x], [(1,2),x^2]], x)
sage: g
Piecewise defined function with 2 parts, [[(0, 1), x |--> x], [(1, 2), x |--> x^2]]
sage: parent(g)
<type 'instance'>
```

And if you type `sage.functions.piecewise??`

at the console to see the source of the module, you see that PiecewisePolynomial is defined purely as a Python class:

```
class PiecewisePolynomial:
"""
Returns a piecewise function from a list of (interval, function)
pairs.
```

2 | No.2 Revision |

As you know, `instance`

is a given case, a given version, of a `class`

. When `parent`

returns `instance`

, that simply means that there's nothing particularly Sage-specific about the structure and it's not living within Sage's Category ~~structure.~~structure, so it's basically returning Python type information.

```
sage: class fred: pass
....:
sage: parent(fred)
<type 'classobj'>
sage: a = fred()
sage: parent(a)
<type 'instance'>
```

which is why we have

```
sage: f(x) = x^2
sage: parent(f)
Callable function ring with arguments (x,)
sage: g = Piecewise([[(0,1),x], [(1,2),x^2]], x)
sage: g
Piecewise defined function with 2 parts, [[(0, 1), x |--> x], [(1, 2), x |--> x^2]]
sage: parent(g)
<type 'instance'>
```

And if you type `sage.functions.piecewise??`

at the console to see the source of the module, you see that PiecewisePolynomial is defined purely as a Python class:

```
class PiecewisePolynomial:
"""
Returns a piecewise function from a list of (interval, function)
pairs.
```

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.