X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=deferred_operand.py;h=9edbb9e8072b451ffc13f447235e3da5505bcff6;hb=e4f0a5a96d6435166699cc1131f655c8904c1ddd;hp=75e98d923d5bcccc135e4d5c05415c7949fac8a9;hpb=e6f32fdd9b373dfcd100c7accb41f57d83c2f0a1;p=python_utils.git diff --git a/deferred_operand.py b/deferred_operand.py index 75e98d9..9edbb9e 100644 --- a/deferred_operand.py +++ b/deferred_operand.py @@ -1,5 +1,13 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""This is a helper class that tries to define every __dunder__ method +so as to defer that evaluation of an object as long as possible. It +is used by smart_future.py as a base class. + +""" + from abc import ABC, abstractmethod from typing import Any, Generic, TypeVar @@ -11,11 +19,12 @@ T = TypeVar('T') class DeferredOperand(ABC, Generic[T]): """A wrapper around an operand whose value is deferred until it is - needed. See subclass SmartFuture for an example usage. + needed (i.e. accessed). See the subclass :class:`SmartFuture` for + an example usage and/or a more useful patten. """ @abstractmethod - def _resolve(self) -> T: + def _resolve(self, timeout=None) -> T: pass @staticmethod