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/2001-October/017780.html below:

[Python-Dev] Need a way to test for 8-bit-or-unicode-string

[Python-Dev] Need a way to test for 8-bit-or-unicode-stringGuido van Rossum guido@python.org
Fri, 05 Oct 2001 12:50:48 -0400
> > *** 1805,1810 ****
> > --- 1805,1829 ----
> >   	else if (PyType_Check(cls)) {
> >   		retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls);
> >   	}
> > + 	else if (PySequence_Check(cls)) {
> > + 		int i, n;
> 
> Is is possible that a type also passes PySequence_Check?  If so, that
> could lead to confusing behavior.

The only way a type could pass PySequence_Check is if someone
subclasses 'type' and adds a __getitem__ method.  In that case, it's
appropriate that PyType_Check() has prevalence.  Also, adding
__getitem__ to a type seems to serve no purpose, so I'm not worried
about this (and yes, I had thought about this :-).

--Guido van Rossum (home page: http://www.python.org/~guido/)



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