[Python-Dev] Attributes access with dict
Eric Smith
eric at trueblade.com
Thu Mar 24 20:18:09 CET 2011
More information about the Python-Dev mailing list
Thu Mar 24 20:18:09 CET 2011
- Previous message: [Python-Dev] Attributes access with dict
- Next message: [Python-Dev] Attributes access with dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> On Thu, Mar 24, 2011 at 10:50:51AM -0700, Guido van Rossum wrote: >> The JSON use case seems to be driven because this is the way >> JavaScript does things -- they don't distinguish between dicts and >> objects. > > That's particular feature has a cure (or poison - for thos who don't > want to mix getattr and getitem): json.load/loads have object_hook > parameter that's used instead of dict. Pass DictRecord (or whatever you > call that) - and voila! > >> I personally think that's a poor language feature: it blurs a >> line that should be clear, between data (dict keys) and program >> variables (attributes). > > Me too. Although we do something similar with namedtuple (instead of using a dict), so it's not like we have a strict distinction. Eric.
- Previous message: [Python-Dev] Attributes access with dict
- Next message: [Python-Dev] Attributes access with dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list