pg.explicit_method_override

Accessible via pg.explicit_method_override, pg.object_utils.explicit_method_override.

explicit_method_override(method)[source]

Decorator that marks a member method as explicitly overridden.

In PyGlove, many methods are managed by the framework - for example - pg.Object.__init__. It’s easy for users to override these methods unconsciously. Therefore, we introduce this decorator to catch error at the first place when such overrides incidentally take place, while allowing advanced users to override them.

Usage:

class Foo(pg.Object):

  @pg.explicit_method_override
  def __init__(self, *args, **kwargs):
   ...
Parameters:

method – method to explicitly overriden.

Returns:

The original method with an explicit overriden stamp.