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/017763.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-stringFred L. Drake, Jr. fdrake@acm.org
Fri, 5 Oct 2001 11:24:22 -0400
Barry A. Warsaw writes:
 > And what would it return?  It needs to return a true value on success,
 > but maybe instead of returning 1, it might be more useful to return
 > the type argument that matched, e.g.:

  Ugh!  If that's what you want, make it explicit in the code:


    for t in ListType, TupleType, ...:
        if isinstance(obj, t):
            break
    else:
        raise Exception('no match!')


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation




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