Task (from Project Spec 3) We'd like you to create a lazy property method in your TimeSeries class. All this method does is return a new LazyOperation instance using an identity function (a function with one argument that just returns the argument) and self as the only argument. This wraps up the TimeSeries instance and a function which does nothing and saves them both for later.
This example should give identical results:
x = TimeSeries([1,2,3,4],[1,4,9,16])
print(x)
print(x.lazy.eval())
(Recall that properties don't need to be called, so x.lazy returns the result of calling the TimeSeries.lazy(self) function, which was decorated with @property.)
This adds a single extra layer of laziness indirection.
You should probably check that running your lazy-fied TimeSeries object works with the check_length example above.
Task (from Project Spec 3) We'd like you to create a lazy property method in your
TimeSeries
class. All this method does is return a newLazyOperation
instance using an identity function (a function with one argument that just returns the argument) and self as the only argument. This wraps up theTimeSeries
instance and a function which does nothing and saves them both for later.This example should give identical results:
(Recall that properties don't need to be called, so
x.lazy
returns the result of calling theTimeSeries.lazy(self)
function, which was decorated with@property
.)This adds a single extra layer of laziness indirection.
You should probably check that running your lazy-fied
TimeSeries
object works with thecheck_length
example above.