Name | gqylpy-dict JSON |
Version |
1.2.6
JSON |
| download |
home_page | http://gqylpy.com |
Summary | `gqylpy-dict` is based on the built-in `dict` and serves as an enhancement to it. It can do everything the built-in `dict` can do, and even more. |
upload_time | 2024-05-27 07:18:00 |
maintainer | None |
docs_url | None |
author | 竹永康 |
requires_python | >=3.8 |
license | WTFPL,Apache-2.0 |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[<img alt='LOGO' src='http://gqylpy.com/static/img/favicon.ico' height='21' width='21'/>](http://www.gqylpy.com)
[](https://github.com/gqylpy/gqylpy-dict/releases/latest)
[](https://pypi.org/project/gqylpy_dict)
[](https://github.com/gqylpy/gqylpy-dict/blob/master/LICENSE)
[](https://pepy.tech/project/gqylpy_dict)
# gqylpy-dict
English | [中文](https://github.com/gqylpy/gqylpy-dict/blob/master/README_CN.md)
> `gqylpy-dict` is based on the built-in `dict` and serves as an enhancement to it. It can do everything the built-in `dict` can do, and even more. _(Designed specifically for the neurologically diverse)_
<kbd>pip3 install gqylpy_dict</kbd>
```python
>>> from gqylpy_dict import gdict
>>> gdict == dict
True
>>> gdict is dict
False
>>> x = {'a': [{'b': 'B'}]}
>>> x = gdict(x)
>>> x.a[0].b
'B'
>>> x.deepget('a[0].b')
'B'
```
Let's delve deeper into the functionalities and usages of the `gdict` class.
Firstly, the `gdict` class is a custom dictionary class that inherits from Python's built-in `dict` class. A special feature of `gdict` is its support for accessing and modifying key-value pairs in the dictionary using dot notation (`.`). This means we can access dictionary values as if they were object attributes. For instance, given a dictionary `{'name': 'Tom', 'age': 25}`, we can define a `gdict` object as follows:
```python
my_dict = gdict({'name': 'Tom', 'age': 25})
```
Using dot notation, we can access the dictionary values:
```python
my_dict.name # 'Tom'
my_dict.age # 25
```
We can even modify the dictionary values:
```python
my_dict.name = 'Jerry'
```
At this point, the value associated with the `'name'` key in the dictionary has been changed to `'Jerry'`.
Additionally, `gdict` supports multi-level nested data structures, meaning the keys and values stored in a `gdict` object can also be dictionaries. For example:
```python
my_dict = gdict({
'personal_info': {'name': 'Tom', 'age': 25},
'work_info': {'company': 'ABC Inc.', 'position': 'Engineer'}
})
```
We can access and modify values in nested dictionaries:
```python
my_dict.personal_info.name # 'Tom'
my_dict.work_info.position = 'Manager'
```
Aside from dot notation, we can also access and modify values in a `gdict` object using traditional dictionary access methods:
```python
my_dict['personal_info']['name'] # 'Tom'
my_dict['work_info']['position'] = 'Manager'
```
Lastly, the `gdict` class supports various input formats during instantiation:
```python
my_dict = gdict({'name': 'Tom', 'age': 25})
my_dict = gdict(name='Tom', age=25)
my_dict = gdict([('name', 'Tom'), ('age', 25)])
```
In summary, the design and implementation of the `gdict` class provide a convenient and extensible data structure that allows for more flexible manipulation of Python dictionary objects.
Raw data
{
"_id": null,
"home_page": "http://gqylpy.com",
"name": "gqylpy-dict",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "\u7af9\u6c38\u5eb7",
"author_email": "<gqylpy@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/c3/2e/41bfa0ef1a20ea397d37c1d968cf348ce06513749b3a0090ce01188f93f2/gqylpy_dict-1.2.6.tar.gz",
"platform": null,
"description": "[<img alt='LOGO' src='http://gqylpy.com/static/img/favicon.ico' height='21' width='21'/>](http://www.gqylpy.com)\n[](https://github.com/gqylpy/gqylpy-dict/releases/latest)\n[](https://pypi.org/project/gqylpy_dict)\n[](https://github.com/gqylpy/gqylpy-dict/blob/master/LICENSE)\n[](https://pepy.tech/project/gqylpy_dict)\n\n# gqylpy-dict\nEnglish | [\u4e2d\u6587](https://github.com/gqylpy/gqylpy-dict/blob/master/README_CN.md)\n\n> `gqylpy-dict` is based on the built-in `dict` and serves as an enhancement to it. It can do everything the built-in `dict` can do, and even more. _(Designed specifically for the neurologically diverse)_\n\n<kbd>pip3 install gqylpy_dict</kbd>\n\n```python\n>>> from gqylpy_dict import gdict\n\n>>> gdict == dict\nTrue\n\n>>> gdict is dict\nFalse\n\n>>> x = {'a': [{'b': 'B'}]}\n>>> x = gdict(x)\n>>> x.a[0].b\n'B'\n\n>>> x.deepget('a[0].b')\n'B'\n```\n\nLet's delve deeper into the functionalities and usages of the `gdict` class.\n\nFirstly, the `gdict` class is a custom dictionary class that inherits from Python's built-in `dict` class. A special feature of `gdict` is its support for accessing and modifying key-value pairs in the dictionary using dot notation (`.`). This means we can access dictionary values as if they were object attributes. For instance, given a dictionary `{'name': 'Tom', 'age': 25}`, we can define a `gdict` object as follows:\n\n```python\nmy_dict = gdict({'name': 'Tom', 'age': 25})\n```\n\nUsing dot notation, we can access the dictionary values:\n\n```python\nmy_dict.name # 'Tom'\nmy_dict.age # 25\n```\n\nWe can even modify the dictionary values:\n\n```python\nmy_dict.name = 'Jerry'\n```\n\nAt this point, the value associated with the `'name'` key in the dictionary has been changed to `'Jerry'`.\n\nAdditionally, `gdict` supports multi-level nested data structures, meaning the keys and values stored in a `gdict` object can also be dictionaries. For example:\n\n```python\nmy_dict = gdict({\n 'personal_info': {'name': 'Tom', 'age': 25},\n 'work_info': {'company': 'ABC Inc.', 'position': 'Engineer'}\n})\n```\n\nWe can access and modify values in nested dictionaries:\n\n```python\nmy_dict.personal_info.name # 'Tom'\nmy_dict.work_info.position = 'Manager'\n```\n\nAside from dot notation, we can also access and modify values in a `gdict` object using traditional dictionary access methods:\n\n```python\nmy_dict['personal_info']['name'] # 'Tom'\nmy_dict['work_info']['position'] = 'Manager'\n```\n\nLastly, the `gdict` class supports various input formats during instantiation:\n\n```python\nmy_dict = gdict({'name': 'Tom', 'age': 25})\nmy_dict = gdict(name='Tom', age=25)\nmy_dict = gdict([('name', 'Tom'), ('age', 25)])\n```\n\nIn summary, the design and implementation of the `gdict` class provide a convenient and extensible data structure that allows for more flexible manipulation of Python dictionary objects.\n",
"bugtrack_url": null,
"license": "WTFPL,Apache-2.0",
"summary": "`gqylpy-dict` is based on the built-in `dict` and serves as an enhancement to it. It can do everything the built-in `dict` can do, and even more.",
"version": "1.2.6",
"project_urls": {
"Homepage": "http://gqylpy.com",
"Source": "https://github.com/gqylpy/gqylpy-dict"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5dfc0e69b3777601450d8f95b93567bf7bdc3c25c47f12e3dbd48c683af440c7",
"md5": "effddb4cb4331971d59befb22db2ec48",
"sha256": "5e355fb1ca6b375e6cb28dae97c0cf3efe8c0be5feaa16a9c37b9f35a9e91ba6"
},
"downloads": -1,
"filename": "gqylpy_dict-1.2.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "effddb4cb4331971d59befb22db2ec48",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14529,
"upload_time": "2024-05-27T07:17:56",
"upload_time_iso_8601": "2024-05-27T07:17:56.824034Z",
"url": "https://files.pythonhosted.org/packages/5d/fc/0e69b3777601450d8f95b93567bf7bdc3c25c47f12e3dbd48c683af440c7/gqylpy_dict-1.2.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c32e41bfa0ef1a20ea397d37c1d968cf348ce06513749b3a0090ce01188f93f2",
"md5": "96ca94a32029771fdaa3e74ba48cbb31",
"sha256": "fd20a98a855b25f4906b2c8cbeaeed7c6fd87c0bf8231dcb0276aa95ae6c92d0"
},
"downloads": -1,
"filename": "gqylpy_dict-1.2.6.tar.gz",
"has_sig": false,
"md5_digest": "96ca94a32029771fdaa3e74ba48cbb31",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12656,
"upload_time": "2024-05-27T07:18:00",
"upload_time_iso_8601": "2024-05-27T07:18:00.131558Z",
"url": "https://files.pythonhosted.org/packages/c3/2e/41bfa0ef1a20ea397d37c1d968cf348ce06513749b3a0090ce01188f93f2/gqylpy_dict-1.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-27 07:18:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gqylpy",
"github_project": "gqylpy-dict",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gqylpy-dict"
}