Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'classes.': 0.05; 'subject:object': 0.07; '>>>>': 0.09; 'builtin': 0.09; '2.7': 0.13; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; '2.6,': 0.16; '3.2.': 0.16; 'attribute,': 0.16; 'subject:function': 0.16; 'wrote:': 0.18; 'possibly': 0.19; '(most': 0.21; 'dec': 0.22; 'header:In-Reply- To:1': 0.22; 'changed': 0.23; 'module,': 0.23; 'traceback': 0.24; "i'm": 0.26; 'function': 0.27; 'import': 0.27; 'message- id:@mail.gmail.com': 0.28; '27,': 0.29; 'print': 0.29; 'pm,': 0.29; 'example': 0.29; 'url:library': 0.31; 'installed': 0.31; 'objects': 0.32; 'tue,': 0.32; 'comment': 0.32; 'instead': 0.33; 'to:addr:python-list': 0.34; 'mostly': 0.34; 'anything': 0.34; 'last):': 0.34; 'url:python': 0.36; 'instead,': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'returned': 0.39; 'url:docs': 0.39; 'url:org': 0.39; 'tool': 0.39; 'missing': 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'type': 0.61; '2011': 0.61; 'your': 0.61; 'candide': 0.84; 'url:functions': 0.84; 'locally': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=v6z1BDZRaIdDzlO+Uv3H/nd65eUJRJvpt756r6iEYu4=; b=NVHWc3/z15TGRYpREuzWb6XE0vKtO03OxcM6IbOCKvO8vpjZOwnt3gSvPX9QYjqle6 Mt2PjK1RDr1DnYsuNSSA2nucWpWYB8sHsk3yVNPQqNOa6cNzLnunjHTC4zHTtC3cx3Lb 7AG/zncBzW8pzV54Mg5+ap+hHfJjk3MOrKBL8= MIME-Version: 1.0 In-Reply-To: <4efa3f05$0$6546$426a74cc@news.free.fr> References: <4efa3f05$0$6546$426a74cc@news.free.fr> Date: Tue, 27 Dec 2011 17:29:25 -0500 Subject: Re: Type object returned by the re.compile function From: Jerry Hill To: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325024967 news.xs4all.nl 6905 [2001:888:2000:d::a6]:59118 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18067 On Tue, Dec 27, 2011 at 4:56 PM, candide wrote: >>>> import re >>>> reo =3D re.compile('') >>>> reo.__class__ > Traceback (most recent call last): > =C2=A0File "", line 1, in > AttributeError: __class__ >>>> I'm not going to comment on what type is returned from the various functions in the re module, mostly because all I have installed locally is 2.6, and I'm not sure if anything has changed in 2.7 or 3.2. Instead, I will recommend a different tool for your toolbox. Take a look at the type() builtin function ( http://docs.python.org/library/functions.html#type ). Particularly, instead of inspecting reo.__class__ in your example above, you can print out type(reo). At a guess, those objects are missing the __class__ attribute, possibly because they are old style classes. --=20 Jerry