benmoran56 / esper

An ECS (Entity Component System) for Python
MIT License
537 stars 67 forks source link

Update to add `contextmanager` #58

Closed f0ursqu4r3 closed 3 years ago

f0ursqu4r3 commented 3 years ago

update to allow for a cleaner usage of the try_component syntax.

with self.world.try_component_ctx(ent, Component) as component:
    component.do_thing()