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/061776.html below:

[Python-Dev] defaultdict and on_missing()

[Python-Dev] defaultdict and on_missing() [Python-Dev] defaultdict and on_missing()Walter Dörwald walter at livinglogic.de
Thu Feb 23 22:55:40 CET 2006
Guido van Rossum wrote:

> On 2/22/06, Michael Chermside <mcherm at mcherm.com> wrote:
>> A minor related point about on_missing():
>>
>> Haven't we learned from regrets over the .next() method of iterators
>> that all "magically" invoked methods should be named using the __xxx__
>> pattern? Shouldn't it be named __on_missing__() instead?
> 
> Good point. I'll call it __missing__. I've uploaded a new patch to
> python.org/sf/1433928.

I always thought that __magic__ method calls are done by Python on 
objects it doesn't know about. The special method name ensures that it 
is indeed the protocol Python is talking about, not some random method 
(with next() being the exception). In the defaultdict case this isn't a 
problem, because defaultdict is calling its own method.

Bye,
    Walter Dörwald

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