News for hackers. Stuff that matters.
Re:Show HN: Gelidum – My Python library to freeze objects by nickysielicki on Monday June 14, 2021 @10:41PM (#27510693)
I like the purity that might come with decorating basically everything in a codebase with `@freeze_params()`, although I wonder/worry about what the runtime overhead might be. I really wish that something like that could be checked statically.
Re:Show HN: Gelidum – My Python library to freeze objects by rcthompson on Monday June 14, 2021 @11:16PM (#27510881)
It probably could be checked statically if someone taught the type checker about this package so that it could track which variables are frozen at which points in the code.
Re:Show HN: Gelidum – My Python library to freeze objects by diegojromero on Tuesday June 15, 2021 @04:21AM (#27512628)
I'd really love if that could checked statically.

Performance is bad, I mean, all params are deep-copied because I assume frozen then "inplace" is not intended as they could be objects used by other parts of code.

Re:Show HN: Gelidum – My Python library to freeze objects by nickysielicki on Tuesday June 15, 2021 @04:58AM (#27512813)
I started googling around and I found the following: https://www.python.org/dev/peps/pep-0591/

It looks like mypy can actually understand the hint: https://mypy.readthedocs.io/en/stable/final_attrs.html

It sucks that this would require such a substantial effort throughout a codebase, though. I guess that’s just the inherent cost of typed python.

Re:Show HN: Gelidum – My Python library to freeze objects by diegojromero on Tuesday June 15, 2021 @06:00AM (#27513129)
Interesting, maybe adding a decorator @freeze_final could be a good idea? I'll take a look at it later.

Thank you for your input!