BstLabs / py-jdict

JavaScript-like Python dictionary
MIT License
18 stars 2 forks source link

[TASK] Jdict show cases and use cases #5

Open ShahriyarR opened 2 years ago

ShahriyarR commented 2 years ago

Describe the task

Need to find awesome use cases and show cases for README

ShahriyarR commented 2 years ago

First one easy looping:

In [23]: for key, value in new_data.data.file.metadata.items():
    ...:     print(key, value)
    ...: 
    ...: 
size {'bytes': 63, 'readable': '63 B'}
name test_py
id n2weifEcx5
ShahriyarR commented 2 years ago

Second is easy value assignment:

n [26]: new_data.status = False

In [27]: new_data
Out[27]: 
{'status': False,
 'data': {'file': {'url': {'short': 'https://anonfiles.com/n2weifEcx5',
    'full': 'https://anonfiles.com/n2weifEcx5/test_py'},
   'metadata': {'size': {'bytes': 63, 'readable': '63 B'},
    'name': 'test_py',
    'id': 'n2weifEcx5'}}}}
ShahriyarR commented 2 years ago

We should describe that jdict acts an ordinary dict type in Python, i.e the copy is the default:

In [28]: hex(id(new_data.data.file))
Out[28]: '0x7fd254d8e4f0'

In [29]: a = new_data.data.file

In [30]: hex(id(a))
Out[30]: '0x7fd254d8e4f0'