EDITED: Let's say I have some classes that inherit from the SuperFoo
abstract class:
from abc import ABCMeta, abstractmethod
class SuperFoo(object):
__metaclass__ = ABCMeta
@abstractmethod
def do_something():
pass
class Foo(SuperFoo):
def __init__(self):
pass
def do_something():
pass
class Bar(SuperFoo):
def __init__(self):
pass
def do_something():
pass
And a documented function that takes in a subclass of SuperFoo
as a parameter:
def build(super_foo):
"""
Instantiate a SuperFoo class and do some other stuff.
@param super_foo: The subclass whose constructor will be called
@type super_foo: ??? <--- What to use here?
@return: An instance of a SuperFoo subclass
@rtype: SuperFoo
"""
# Do some stuff
instance = class_name() # Instantiate class
return instance
foo = build(Foo)
bar = build(Bar)
What @type
should I use in the function's docstring? It cannot be SuperFoo
because that would correspond to an instance of SuperFoo
and not to the type itself.