pythonintermediate

Reflection

Advanced Python pattern: reflection

python
class Service:
    def run(self) -> str:
        return 'ok'

obj = Service()
method = getattr(obj, 'run')
print(method())

Use Cases

  • advanced programming
  • patterns

Tags

Related Snippets

Similar patterns you can reuse in the same workflow.