Verify values have been computed

Issue #167 open
Bradley Dice created an issue

All data retrieval methods that require calling a compute() method first should raise an exception if the requested data has not yet been computed.

Comments (5)

  1. Bradley Dice reporter

    @vramasub I would like to handle this in the near term, to be released with the refactoring for memoryviews in PR #246. It's slightly more important when using memoryviews, because memoryviews throw errors that are slightly more confusing when one of their dimensions is zero. There are way too many places where users can access uninitialized memory by creating compute objects and querying their properties. What do you think about adding an internal Python-level property self._computed and a method self._ensure_computed() (to raise errors if self._computed is False) that is called by property-getters?

  2. Vyas Ramasubramani

    I think that sounds like a reasonable plan. More and more, I'm moving back towards wanting to have an abstract parent compute class that defines some basic things like this for everything... but that's a separate discussion and needs more thought. For now, I'd be OK with just duplicating some code and implementing this for the various classes as needed.

  3. Log in to comment