Modifying sometype.__dict__
You can't directly set an attribute of a builtin type
int.real = 69
TypeError: cannot set 'real' attribute of immutable type 'int'
You also can't modify __dict__
int.__dict__["real"] = 69
TypeError: 'mappingproxy' object does not support item assignment
Mappingproxy provides a read-only proxy for mapping, which prevents modification. However, you can now bypass that using the bypassmappingproxy module
(it is written in pure python)
from bypassmappingproxy as bmp
assert (1).real == 1
bmp.type_set(int, "real", 69)
assert (1).real == 69
Metadata
Release files for bypassmappingproxy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bypassmappingproxy-0.1.0.tar.gz | 1.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bypassmappingproxy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.4 kB
Release files / bypassmappingproxy-0.1.0.tar.gz
| Download URL | bypassmappingproxy-0.1.0.tar.gz |
|---|---|
| Size | 1.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfb9fabfd0d97702c75300d119a858c9edeb7de56fde0b323f1a27693caeca62
|
|
BLAKE2b-256 checksum How to use checksums |
c75113780e21aab0549b0168fd0647a9219c6ecac72c560a3d2a1fc441c8d1b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / bypassmappingproxy-0.1.0-py3-none-any.whl
| Download URL | bypassmappingproxy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5387d31e1623398847148739a272e42ea3b92551300c9f29711043e6cfb93373
|
|
BLAKE2b-256 checksum How to use checksums |
c0d1845e93b5f534000413d62e046adaa45a9fced8a7517ec462deb7ed7d9677
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|