Closed mccalluc closed 3 weeks ago
This might be a little cleaner:
- pl = import_optional_dependency("polars", raise_error=False) - if pl is not None: + with optional_dependency("polars") as pl:
Context managers can't skip code: That's just not what they do. We could have a context manager, but then we'd also need to handle possible exceptions outside, and that's worse. Closing.
This might be a little cleaner: