# Changes values in tuples using ctypes
## Important: Never use this in a real project! Hacked tuples might lead to unexpected results!
```python
from tuplechanger import tuplechanger
tutu = ('babaxxiq',-2,3.44, True, 800,1211)
print(id(tutu))
print(tutu)
tuindex = 0
tuplechanger(tutu, tuindex, 'bbbbxxxi')
print(tutu)
tuindex = 1
tuplechanger(tutu, tuindex, -4)
print(tutu)
tuindex = 2
tuplechanger(tutu, tuindex, 13.44)
print(tutu)
tuindex = 3
tuplechanger(tutu, tuindex, False)
print(tutu)
tuindex = 4
tuplechanger(tutu, tuindex, 17000)
print(tutu)
tuindex = 5
tuplechanger(tutu, tuindex, 1111)
print(tutu)
print(id(tutu))
# 1843849020512
# ('babaxxiq', -2, 3.44, True, 800, 1211)
# ('bbbbxxxi', -2, 3.44, True, 800, 1211)
# ('bbbbxxxi', -4, 3.44, True, 800, 1211)
# ('bbbbxxxi', -4, 13.44, True, 800, 1211)
# ('bbbbxxxi', -4, 13.44, False, 800, 1211)
# ('bbbbxxxi', -4, 13.44, False, 17000, 1211)
# ('bbbbxxxi', -4, 13.44, False, 17000, 1111)
# 1843849020512
```
## Why you shouldn't use it in a real project:
```python
# It looks pretty good as first sight, but ...
# tutu[0] + 'xxxx'
# Out[3]: 'bbbbxxxixxxx'
# tutu[1] + 5
# Out[4]: 1
# tutu[2] + 5.999
# Out[5]: 19.439
# tutu[3] is False
# Out[6]: True
# tutu[4] > 15000
# Out[7]: True
# tutu[5] < 1200
# Out[8]: True
# tutu[-1] < 1200
# Out[9]: True
# tutu[-2] < 15000
# Out[10]: True
# tutu[-3] is False
# Out[11]: True
# tutu[-4] + 5.999
# Out[12]: 19.439
# tutu[1] + 5
# Out[13]: 1
# ... it isn't a good idea to hack tuples:
# tutu[2] + tutu[4] # positive index, everything is fine
# Out[3]: 17013.44
# WRONG!!!
# tutu[-2] + tutu[-4] # negative index, crap
# Out[6]: 26.88
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/tuplechanger",
"name": "tuplechanger",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ctypes,hacking,tuples",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/65/21/dfdf4201f2558fe82988dcb16530b1eadbe763ab59cde05b1ccb4fd1a29b/tuplechanger-0.10.tar.gz",
"platform": null,
"description": "# Changes values in tuples using ctypes \r\n\r\n## Important: Never use this in a real project! Hacked tuples might lead to unexpected results! \r\n\r\n\r\n```python\r\n\r\nfrom tuplechanger import tuplechanger\r\n\r\n\r\ntutu = ('babaxxiq',-2,3.44, True, 800,1211)\r\nprint(id(tutu))\r\nprint(tutu)\r\ntuindex = 0\r\ntuplechanger(tutu, tuindex, 'bbbbxxxi')\r\nprint(tutu)\r\ntuindex = 1\r\ntuplechanger(tutu, tuindex, -4)\r\nprint(tutu)\r\ntuindex = 2\r\ntuplechanger(tutu, tuindex, 13.44)\r\nprint(tutu)\r\ntuindex = 3\r\ntuplechanger(tutu, tuindex, False)\r\nprint(tutu)\r\ntuindex = 4\r\ntuplechanger(tutu, tuindex, 17000)\r\nprint(tutu)\r\ntuindex = 5\r\ntuplechanger(tutu, tuindex, 1111)\r\nprint(tutu)\r\nprint(id(tutu))\r\n# 1843849020512\r\n# ('babaxxiq', -2, 3.44, True, 800, 1211)\r\n# ('bbbbxxxi', -2, 3.44, True, 800, 1211)\r\n# ('bbbbxxxi', -4, 3.44, True, 800, 1211)\r\n# ('bbbbxxxi', -4, 13.44, True, 800, 1211)\r\n# ('bbbbxxxi', -4, 13.44, False, 800, 1211)\r\n# ('bbbbxxxi', -4, 13.44, False, 17000, 1211)\r\n# ('bbbbxxxi', -4, 13.44, False, 17000, 1111)\r\n# 1843849020512\r\n```\r\n\r\n## Why you shouldn't use it in a real project: \r\n\r\n```python\r\n# It looks pretty good as first sight, but ... \r\n# tutu[0] + 'xxxx'\r\n# Out[3]: 'bbbbxxxixxxx'\r\n# tutu[1] + 5\r\n# Out[4]: 1\r\n# tutu[2] + 5.999\r\n# Out[5]: 19.439\r\n# tutu[3] is False\r\n# Out[6]: True\r\n# tutu[4] > 15000\r\n# Out[7]: True\r\n# tutu[5] < 1200\r\n# Out[8]: True\r\n# tutu[-1] < 1200\r\n# Out[9]: True\r\n# tutu[-2] < 15000\r\n# Out[10]: True\r\n# tutu[-3] is False\r\n# Out[11]: True\r\n# tutu[-4] + 5.999\r\n# Out[12]: 19.439\r\n# tutu[1] + 5\r\n# Out[13]: 1\r\n\r\n# ... it isn't a good idea to hack tuples:\r\n\r\n\r\n# tutu[2] + tutu[4] # positive index, everything is fine \r\n# Out[3]: 17013.44\r\n\r\n\r\n# WRONG!!!\r\n# tutu[-2] + tutu[-4] # negative index, crap\r\n# Out[6]: 26.88\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Changes values in tuples using ctypes",
"version": "0.10",
"split_keywords": [
"ctypes",
"hacking",
"tuples"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "64e4e930e04810faa06073bacad75df647c3d1e39804b5ab2bc4f93efaea6f52",
"md5": "78f60e87589e559dc675f1c16a09a9f5",
"sha256": "579d71c986bf20679a851a55a0cefcea8e20484ddfa66d6512ef4e376160f1ed"
},
"downloads": -1,
"filename": "tuplechanger-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78f60e87589e559dc675f1c16a09a9f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7005,
"upload_time": "2023-04-17T18:39:58",
"upload_time_iso_8601": "2023-04-17T18:39:58.608827Z",
"url": "https://files.pythonhosted.org/packages/64/e4/e930e04810faa06073bacad75df647c3d1e39804b5ab2bc4f93efaea6f52/tuplechanger-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6521dfdf4201f2558fe82988dcb16530b1eadbe763ab59cde05b1ccb4fd1a29b",
"md5": "a0acb34ce06200b7e8be4356fa40e944",
"sha256": "99a48d124c063d2fbe3eb1b01b9c4e031294a7d0910f05df7b2ae330ed4ffb97"
},
"downloads": -1,
"filename": "tuplechanger-0.10.tar.gz",
"has_sig": false,
"md5_digest": "a0acb34ce06200b7e8be4356fa40e944",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5568,
"upload_time": "2023-04-17T18:40:00",
"upload_time_iso_8601": "2023-04-17T18:40:00.262694Z",
"url": "https://files.pythonhosted.org/packages/65/21/dfdf4201f2558fe82988dcb16530b1eadbe763ab59cde05b1ccb4fd1a29b/tuplechanger-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-17 18:40:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "tuplechanger",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "tuplechanger"
}