Cannot import piecewise from nengo.utils.functions

I’m practicing with the nengo 2.0 tutorials from hbb. on chaprer 3 tutorial, unable to import function piecewise from nengo.utils.functions.

this ia functions.py from nengo source. code:

def function_name(func):
    """Returns the name of a function.
    Unlike accessing ``func.__name__``, this function is robust to the
    different types of objects that can be considered a function in Nengo.
    Parameters
    ----------
    func : callable or array_like
        Object used as function argument.
    Returns
    -------
    str
        Name of function object.
    """
    return getattr(func, "__name__", func.__class__.__name__)

Hi @hotasalah, and welcome to the Nengo forums! :smiley:

It would appear that the Jupyter notebook in question is out of date, and will need to be updated. In the mean time, you can find the up-to-date versions of the code within the NengoGUI itself. It’s under

built-in examples > hbb_tutorials

Thanks @xchoo :slight_smile: it worked.