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


Groups > comp.lang.python > #73055

Re: None in string => TypeError?

References (1 earlier) <20140609185728.3cac55ab@x34f> <03B8D21C-62B4-4344-AA25-FF82501C33D0@panix.com> <CAPTjJmqt+2doOdr-UJTMsDu1f1ZnKD+WEp5SY_LGekR3-FsuOg@mail.gmail.com> <CALwzidkRYToie4f385AwyDq0mG2TEqSz0J8si=R0H0ZMFs4vMg@mail.gmail.com> <CAPTjJmqidANye+3QoyHEr14-04nLXU-dLss0Y7X5eW6OJtChmA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-06-09 11:58 -0600
Subject Re: None in string => TypeError?
Newsgroups comp.lang.python
Message-ID <mailman.10932.1402336745.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jun 9, 2014 at 11:40 AM, Chris Angelico <rosuav@gmail.com> wrote:
> Also, this is the first time I've seen None as a constant other than
> the first. Usually co_consts[0] is None, but this time co_consts[4] is
> None.

Functions always seem to have None as the first constant, but modules
and classes are other examples that don't.

>>> co = compile("class MyClass: pass", '', 'exec')
>>> co.co_consts
(<code object MyClass at 0x7f32aa0a3c00, file "", line 1>, 'MyClass', None)
>>> co.co_consts[0].co_consts
('MyClass', None)

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


Thread

None in string => TypeError? Roy Smith <roy@panix.com> - 2014-06-09 08:34 -0700
  Re: None in string => TypeError? Ryan Hiebert <ryan@ryanhiebert.com> - 2014-06-09 10:42 -0500
  Re: None in string => TypeError? Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-09 09:50 -0600
  Re: None in string => TypeError? Paul Sokolovsky <pmiscml@gmail.com> - 2014-06-09 18:57 +0300
    Re: None in string => TypeError? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 16:14 +0000
      Re: None in string => TypeError? Chris Angelico <rosuav@gmail.com> - 2014-06-10 02:31 +1000
  Re: None in string => TypeError? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 16:07 +0000
  Re: None in string => TypeError? MRAB <python@mrabarnett.plus.com> - 2014-06-09 17:06 +0100
  Re: None in string => TypeError? Shiyao Ma <i@introo.me> - 2014-06-10 00:13 +0800
  Re: None in string => TypeError? Roy Smith <roy@panix.com> - 2014-06-09 12:53 -0400
  Re: None in string => TypeError? Chris Angelico <rosuav@gmail.com> - 2014-06-10 02:59 +1000
  Re: None in string => TypeError? Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-09 11:22 -0600
  Re: None in string => TypeError? Chris Angelico <rosuav@gmail.com> - 2014-06-10 03:40 +1000
  Re: None in string => TypeError? Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-09 11:58 -0600
  Re: None in string => TypeError? Chris Angelico <rosuav@gmail.com> - 2014-06-10 04:02 +1000

csiph-web