In tri.struct we have a class Frozen
https://github.com/TriOptima/tri.struct/blob/master/lib/tri/struct/__init__.py
that can be used to freeze stuff. I think something like this would be even
better in the standard library, especially now with data classes! If we had
this frozendict would just be:
class frozendict(dict, Frozen):
pass
/ Anders
> On 10 Oct 2018, at 19:04, Philip Martin <[email protected]> wrote:
>
> Hi, I first want to thank everyone in the community for the contributions
> over the years. I know the idea of a frozendict has been proposed before and
> rejected. I have a use case for a frozendict implementation that to my
> knowledge was not discussed during previous debates. My reasoning for a
> frozendict class stems from patterns I typically see arise when performing
> ETL or data integrations and conversions. I generally have used
> MappingProxyType as a way to set default mapping to a function or to set an
> empty mapping to a function. I've created a gist with an example use case:
>
> https://gist.github.com/pmart123/493edf84d9aa61691ca7321325ebb6ab
>
> I've included an example of what code typically looks like when using
> MappingProxyType and what it could look like with a frozendict
> implementation. I believe this use case may also be under-reported in open
> source code as it often crops up when integrating third-party data sources,
> which at times can't be open sourced due to licensing issues. I would love to
> hear if anyone has used MappingProxyType in a similar manner, or if this use
> case could help warrant a frozendict in the standard library.
> _______________________________________________
> Python-ideas mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/