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/2003-November/040319.html below:

[Python-Dev] __reversed__ protocol

[Python-Dev] __reversed__ protocol [Python-Dev] __reversed__ protocolRaymond Hettinger python at rcn.com
Tue Nov 18 20:44:13 EST 2003
> Note that the two HasAttrString calls can be quite a bit more
> expensive than the PyRange_Check and PyList_Check calls...

Right!  So we need to keep those:

	if (PyRange_Check(seq) || PyList_Check(seq) ||
	    PyObject_HasAttrString(seq, "__reversed__") && 
	    PyObject_HasAttrString(seq, "__len__"))
		return PyObject_CallMethod(seq, "__reversed__", NULL);



Raymond


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