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/2000-February/002077.html below:

[Python-Dev] __contains__ hook: follow-up

[Python-Dev] __contains__ hook: follow-up [Python-Dev] __contains__ hook: follow-upMoshe Zadka Moshe Zadka <mzadka@geocities.com>
Sat, 5 Feb 2000 02:15:37 +0200 (IST)
I've sent a patch to patches@python.org which does the 'in' hook in the
pseudo-right way: adding a slot to the sequence methods structure, and
adding a flag to support it for backwards compatability.

Now that it's there, I've also changed instance method to use it, and to
map it to __contains__. The code there also has special-case for strings,
so if someone (maybe me) adds such a slot to strings, then the code will
only have to do the C equivalent of

try:
	obj.__contains__(whatever)
except AttributeError:
	for element in obj:
		if element == whatever:
			return 1
	return 0

Is this desirable? It shouldn't be too hard...

--
Moshe Zadka <mzadka@geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.




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