python-tabulate icon indicating copy to clipboard operation
python-tabulate copied to clipboard

Do not call `getattr` with a constant value

Open DimitriPapadopoulos opened this issue 4 months ago • 0 comments

It is not any safer than normal property access.

It feels like the intent might have been hasattr() instead of getattr(), but the initial commit e2086c3 appears to :

  • assume any attribute dtype is of type numpy.dtype,
  • test whether numpy.dtype.names is a list of fields names or None.

https://numpy.org/doc/stable/reference/generated/numpy.dtype.names.html

Requires https://github.com/astanin/python-tabulate/pull/373.

DimitriPapadopoulos avatar Sep 13 '25 14:09 DimitriPapadopoulos