A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-March/110031.html below:

[Python-Dev] Attributes access with dict

[Python-Dev] Attributes access with dict [Python-Dev] Attributes access with dictOleg Broytman phd at phdru.name
Thu Mar 24 19:26:18 CET 2011
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.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4