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/2006-February/061272.html below:

[Python-Dev] Counter proposal: multidict (was: Proposal: defaultdict)

[Python-Dev] Counter proposal: multidict (was: Proposal: defaultdict) [Python-Dev] Counter proposal: multidict (was: Proposal: defaultdict)Jack Diederich jack at performancedrivers.com
Fri Feb 17 21:25:14 CET 2006
On Fri, Feb 17, 2006 at 03:03:06PM -0500, Fred L. Drake, Jr. wrote:
> On Friday 17 February 2006 14:51, Ian Bicking wrote:
>  > and in the process breaking an important 
>  > quality of good Python code, that attribute and getitem access not have
>  > noticeable side effects.
> 
> I'm not sure that's quite as well-defined or agreed upon as you do.
 
Without the __getitem__ side effect default objects that don't support any
operators would have problems.

  d[key] += val

works fine when the default is a list or int but fails for dicts and presumably
many user defined objects.  By assigning the default value in __getitem__ the
returned value can be manipulated via its methods.

-Jack

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