On Thu, 24 Dec 2020, Carl Friedrich Bolz-Tereick wrote:

Another approach would indeed be (as you say in the other mail) to add support for telling PyPy explicitly that some list can contain only instances of a specific class and (more importantly) that a class is not to be considered to be "dynamic" meaning that its fields are fixed and of specific types. So far, we have not really gone in such directions, because that is language design and we leave that to the CPython devs ;-).

Hmmm, how about dataclasses ;-) Maybe those can be used as optimization targets under some reasonable assumptions:

@dataclass
class Point3D:
    x: float
    y: float
    z: float

Feels pythonic much to me...

--
Sincerely yours,
Yury V. Zaytsev
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to