Which of the following correctly uses `contextlib.suppress`?

Python Professional Hard

Python Professional — Hard

Which of the following correctly uses `contextlib.suppress`?

Key points

  • `contextlib.suppress` does not log exceptions or convert them to warnings.
  • It does not raise exceptions silently.
  • It can suppress any specified exceptions, not just IOError.

Ready to go further?

Related questions