bytecodealliance / componentize-py

Apache License 2.0
147 stars 16 forks source link

Make the types generated for WIT resources context managers #54

Closed dicej closed 8 months ago

dicej commented 8 months ago

Per https://docs.python.org/3/library/stdtypes.html#typecontextmanager, the idiomatic way to represent resource types is as context managers, each with an __exit__ method that drops the resource. This will allow them to be used in with statements.