A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-March/117145.html below:

[Python-Dev] Add a frozendict builtin type

[Python-Dev] Add a frozendict builtin type [Python-Dev] Add a frozendict builtin typeVictor Stinner victor.stinner at haypocalc.com
Thu Mar 1 10:11:03 CET 2012
>> Problem: if you implement a frozendict type inheriting from dict in
>> Python, it is still possible to call dict methods (e.g.
>> dict.__setitem__()). To fix this issue, pysandbox removes all dict
>> methods modifying the dict: __setitem__, __delitem__, pop, etc. This
>> is a problem because untrusted code cannot use these methods on valid
>> dict created in the sandbox.
>
>
> You can redefine dict.__setitem__.

Ah? It doesn't work here.

>>> dict.__setitem__=lambda key, value: None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'dict'

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4