Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39014

Comparing types

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!goblin3!goblin1!goblin.stu.neva.ru!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'python': 0.09; 'nameerror:': 0.09; 'str)': 0.09; 'oct': 0.16; '>>>': 0.18; 'import': 0.21; '"",': 0.22; 'defined': 0.22; '(most': 0.27; 'message-id:@mail.gmail.com': 0.27; 'regular': 0.27; 'skip:_ 10': 0.29; 'file': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'object': 0.38; 'to:addr:python.org': 0.39; 'more': 0.63; 'type(s)': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=BULwsN26759Tr2k6epAZKU+PdwzHhL2Atu10WLBPHd4=; b=JnaZsud+RgLoFMVtU5DSpXzj5g3RFfyMyQhFW120mC5dGbD421bjhxXJ3I7hXT+zIL 1shQRwuznEqa2Q0dWlcYTjC8RCgPY4ClvIzmj5PCR4oTEuiqQnXUHXqNBuANdrNFrOyC wkUzPIJcEWwgofAWaB3I00Xp5sOneP4Aa8wSZoe2FWOTXDjiRvn4JM5mlbITFueVhr7D bWz+98eZNYtad9iwUd7PACamzJeKCoFP7aTL07ogYaJYwrkNwBtaqmsPqsuI1zdNabbk pZigBF+1EseoBEALLnx1MTYcoF9NAOaCCyPIDh8CDwwH/VN9bRkzM6XHQVOvF68swgT2 qc9g==
MIME-Version 1.0
X-Received by 10.50.195.134 with SMTP id ie6mr4412339igc.6.1361082898031; Sat, 16 Feb 2013 22:34:58 -0800 (PST)
Date Sat, 16 Feb 2013 23:34:57 -0700
Subject Comparing types
From Jason Friedman <jsf80238@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1881.1361082907.2939.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361082907 news.xs4all.nl 6914 [2001:888:2000:d::a6]:47809
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39014

Show key headers only | View raw


I want to tell whether an object is a regular expression pattern.

Python 3.2.3 (default, Oct 19 2012, 20:10:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> s = "hello"
>>> type(s)
<class 'str'>
>>> isinstance(s, str)
True
>>> my_pattern = re.compile(s)
>>> type(my_pattern)
<class '_sre.SRE_Pattern'>
>>> isinstance(my_pattern, _sre.SRE_Pattern)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '_sre' is not defined

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Comparing types Jason Friedman <jsf80238@gmail.com> - 2013-02-16 23:34 -0700
  Re: Comparing types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-17 19:38 +1100
  Re: Comparing types Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-17 14:13 -0800
    Re: Comparing types Chris Angelico <rosuav@gmail.com> - 2013-02-18 17:50 +1100
  Re: Comparing types Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-17 14:13 -0800

csiph-web