[petsc-dev] How come petsc4py objects do not handle attributes in the "standard" way?

Aron Ahmadia aron at ahmadia.net
Mon Mar 6 20:33:59 CST 2023


I suspect because properties were not yet “cool” when Lisandro designed the
attribute system.

Numpy’s design similarly also predate a lot of the property semantics in
the higher abstraction interfaces of Python.

We attempted some of these tricks with pyclaw and I think regretted at
least some of them.

Aron



On Mon, Mar 6, 2023 at 9:19 PM Barry Smith <bsmith at petsc.dev> wrote:

>
>   How come petsc4py has the (nonstandard?) v.setAttr('name',value) and
> v.getAttr('name') instead of v.name notation? Could they be refactored to
> have "normal" attribute behavior? If not, could a v.hasAttr('name') be
> added?
>
>   Similarly, how come numpy arrays seem to have no way to set attributes
> on them?
>
>   PyTorch tensors seem to support the standard t.name handling of
> attributes.
>
>    Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20230306/0445dc46/attachment.html>


More information about the petsc-dev mailing list