Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111770
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: learning python. learning defining functions . need help |
| Date | 2016-07-22 19:36 +0100 |
| Message-ID | <mailman.62.1469212620.22221.python-list@python.org> (permalink) |
| References | (1 earlier) <ji44pbpbaj6olkqcq832ivm7q7gl5d1aca@4ax.com> <CAPTjJmq6nnqp3434HNkxZLPm-igt-vk76u1GZVsr7euhWd4f8Q@mail.gmail.com> <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com> <20160722114118.6a809d29@imp> <3379130e-1205-9f02-61c6-e30aee47435f@mrabarnett.plus.com> |
On 2016-07-22 16:41, D'Arcy J.M. Cain wrote: > 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. > If you're checking that it's a dict, there's no need to check whether it's None, because None isn't a dict either!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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