New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:

types.SimpleNamespace() would be much more usable if it were more substitutable 
for dictionaries.   In particular, it would be wonderful to be able to use 
object_hook=SimpleNamespace in json.load():

Current:

     catalog = json.load(f)
     print(catalog['clothing']['mens']['shoes']['extra_wide']['quantity'])

Proposed:

     catalog = json.load(f, object_hook=SimpleNamespace)
     print(catalog.clothing.mens.shoes.extra_wide.quantity])

----------
components: Library (Lib)
messages: 366447
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Add mapping methods to types.SimpleNamespace
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40284>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to