# Revision history [back]

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.


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.