LSSTDESC / sacc

Save All Correlations and Covariances
BSD 3-Clause "New" or "Revised" License
15 stars 8 forks source link

Request to add a `has_tracer` method to `sacc.Sacc` #97

Closed marcpaterno closed 1 year ago

marcpaterno commented 1 year ago

Currently, to test whether a sacc.Sacc object contains a tracer of a given name, it seems one must either:

  1. use the method get_tracer and catch the resulting KeyError if there is no such tracer, or
  2. directly access the tracers instance variable.

The existence of the get_tracer method, which does the key lookup for the caller, seems to be an indication that client code making direct access to the instance variables is not preferred.

Can we then have a has_tracer method to make the query simpler for client code, without having the client code access the instance variable tracers directly?

I will create a pull request for this feature.