[Python-Dev] sys.implementation

Nick Coghlan ncoghlan at gmail.com
Sat May 12 14:04:01 CEST 2012


On Sat, May 12, 2012 at 12:40 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> If anyone has strong feelings for item-access over attribute-access,
> please elaborate.  I'm just not seeing it as that important and would
> rather finish up the PEP as simply as possible.

I object to adding a new type to the stdlib just for this PEP. Since
iterating over the keys is significantly more useful than iterating
over the values, that suggests a dictionary as the most appropriate
type.

If someone *really* wants a quick way to get dotted access to the
contents of dictionary:

>>> data = dict(a=1, b=2, c=3)
>>> ns = type('', (), data)
>>> ns.a
1
>>> ns.b
2
>>> ns.c
3

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list