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


Groups > comp.lang.python > #52313

Re: Python Basic Doubt

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jarabal@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'subject:Python': 0.06; 'none,': 0.07; 'python': 0.11; '"is"': 0.16; 'escribi\xf3:': 0.16; 'list)': 0.16; 'thanks.': 0.20; 'example': 0.22; 'header:User-Agent:1': 0.23; 'compare': 0.26; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'list:': 0.30; 'chase': 0.31; 'exceptions': 0.31; 'basic': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'doing': 0.36; 'clear': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python- list': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; "you're": 0.61; 'more': 0.64
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=LUwa0Ch9SoX/zV/aw1HEUL3MtEC6a6yHazvuunk9jQs=; b=e2HcZfb/6X4AXR3O4uO6pOLlwOVZjK2ZEwLkxMnXlsYa6aB4rt7SsrZ64YLi2xy5Gw IDZ2BCQ/XY23I40xE7rGCuxi5EW2SeY5n5x/ayZ+1qNCPWXlCFMMpNCoha6YNfCbELtv hcTuHg9+8YsUi9EJaU1MF73tEK0Rfap2pKDGrGWCdtknIGh/6Htw67rmNHH1BkKth4/o SdJqPwK9oCKJQBdUPS9LDy1LYCsdZqH4gpqLVeSFHpZS2WNKwfvdGA0P+jUOMsGr5TRf zGe5COhM4w5BJvHh2qk//YXPsJP1HjWRWZXQhbhvHfa9H1y27U1YLBqOLWmsOYntD1jw R5fQ==
X-Received by 10.194.235.138 with SMTP id um10mr3215191wjc.30.1376157662334; Sat, 10 Aug 2013 11:01:02 -0700 (PDT)
Date Sat, 10 Aug 2013 20:00:58 +0200
From Xavi <jarabal@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version 1.0
To python-list@python.org
Subject Re: Python Basic Doubt
References <CAL0E0u6wO_UBniWoSpePvhKhPDG_nf4p1rqYYrGwzoHTqp6ZHA@mail.gmail.com> <20130810114040.6ac78fe8@bigbox.christie.dr>
In-Reply-To <20130810114040.6ac78fe8@bigbox.christie.dr>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-Mailman-Approved-At Sat, 10 Aug 2013 20:03:25 +0200
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.432.1376157806.1251.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376157806 news.xs4all.nl 15982 [2001:888:2000:d::a6]:49203
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52313

Show key headers only | View raw


Hello,

El 10/08/2013 18:40, Tim Chase escribió:
> Generally, if you are using the "is" operator to compare against
> anything other than None, you're doing it wrong. There are exceptions
> to this, but it takes knowing the particulars.

Now I have one doubt, I use 'is' to compare basic types in python 3, for example .-

v = []
if type(v) is list:
     print('Is list...')

Because I think it is more clear and faster than .-
type(v) == [].__class__  ... or ... isinstance(v, list)

Is this correct?
Thanks.
-- 
Xavi

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


Thread

Re: Python Basic Doubt Xavi <jarabal@gmail.com> - 2013-08-10 20:00 +0200
  Re: Python Basic Doubt Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-10 19:32 +0000
    Re: Python Basic Doubt Xavi <jarabal@gmail.com> - 2013-08-11 18:58 +0200
      Re: Python Basic Doubt Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-12 01:08 +0000

csiph-web