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


Groups > comp.lang.python > #111769

Re: learning python. learning defining functions . need help

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "D'Arcy J.M. Cain" <darcy@Vex.Net>
Newsgroups comp.lang.python
Subject Re: learning python. learning defining functions . need help
Date Fri, 22 Jul 2016 11:41:18 -0400
Organization Vex.Net
Lines 13
Message-ID <mailman.61.1469210808.22221.python-list@python.org> (permalink)
References <432aeb03-ea14-4ece-8e5b-a7521cf12b84@googlegroups.com> <ji44pbpbaj6olkqcq832ivm7q7gl5d1aca@4ax.com> <CAPTjJmq6nnqp3434HNkxZLPm-igt-vk76u1GZVsr7euhWd4f8Q@mail.gmail.com> <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com> <20160722114118.6a809d29@imp>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de RJfc3AdgzkeaMjTyoDhfWwrjaYgnxLCA5yeGbyZmytjg==
Return-Path <darcy@Vex.Net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:help': 0.07; 'cc:addr:python-list': 0.09; 'dict': 0.09; 'subclass': 0.09; '2016': 0.16; 'justin': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:python.': 0.16; 'wrote:': 0.16; 'subject:need': 0.18; 'cc:addr:python.org': 0.20; 'handles': 0.20; 'cc:2**1': 0.22; 'cc:addr:gmail.com': 0.24; 'header:In-Reply- To:1': 0.24; 'fri,': 0.27; 'subject:learning': 0.29; 'classes': 0.30; '-0700': 0.33; 'could': 0.35; 'replace': 0.35; 'stock': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'well.': 0.40; 'subject:. ': 0.67; 'jul': 0.72; 'received:98.158': 0.84; 'subject: . ': 0.84; 'walters': 0.84
In-Reply-To <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com>
X-Mailer Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu)
X-Mailman-Approved-At Fri, 22 Jul 2016 14:06:48 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <20160722114118.6a809d29@imp>
X-Mailman-Original-References <432aeb03-ea14-4ece-8e5b-a7521cf12b84@googlegroups.com> <ji44pbpbaj6olkqcq832ivm7q7gl5d1aca@4ax.com> <CAPTjJmq6nnqp3434HNkxZLPm-igt-vk76u1GZVsr7euhWd4f8Q@mail.gmail.com> <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com>
Xref csiph.com comp.lang.python:111769

Show key headers only | View raw


On Fri, 22 Jul 2016 08:21:17 -0700
justin walters <walters.justin01@gmail.com> wrote:
> You could also replace that line with:
> 
>     if stock is None or type(stock) != dict:

Use isinstance().  That handles classes that subclass dict as well.

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy@Vex.Net
VoIP: sip:darcy@Vex.Net

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


Thread

learning python. learning defining functions . need help sigmaphine1914@gmail.com - 2016-07-21 19:27 -0700
  Re: learning python. learning defining functions . need help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-22 09:13 -0400
  Re: learning python. learning defining functions . need help Chris Angelico <rosuav@gmail.com> - 2016-07-22 23:24 +1000
  Re: learning python. learning defining functions . need help justin walters <walters.justin01@gmail.com> - 2016-07-22 08:21 -0700
    Re: learning python. learning defining functions . need help Steven D'Aprano <steve@pearwood.info> - 2016-07-23 11:44 +1000
  Re: learning python. learning defining functions . need help Random832 <random832@fastmail.com> - 2016-07-22 11:35 -0400
  Re: learning python. learning defining functions . need help Chris Angelico <rosuav@gmail.com> - 2016-07-23 01:35 +1000
  Re: learning python. learning defining functions . need help "D'Arcy J.M. Cain" <darcy@Vex.Net> - 2016-07-22 11:41 -0400
  Re: learning python. learning defining functions . need help MRAB <python@mrabarnett.plus.com> - 2016-07-22 19:36 +0100
  Re: learning python. learning defining functions . need help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-22 20:04 -0400
  Re: learning python. learning defining functions . need help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-23 11:39 -0400

csiph-web