Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26460
| Date | 2012-08-03 19:03 -0400 |
|---|---|
| From | Dave Angel <d@davea.name> |
| Subject | Re: attribute is accessed from Nonetype |
| References | <CAMLC9n6ES9CwCE_OqEsnvQJ1gG_2MJEmrkjzQaM7tPQ4-4k0nA@mail.gmail.com> <501A5EAF.9090501@davea.name> <5B80DD153D7D744689F57F4FB69AF4741659DDF5@SCACMX008.exchad.jpmchase.net> <501C4EB1.80003@davea.name> <CAPTjJmqA14Pz8-dDsHyAdH-Kdh8SBdg1VO_k5sN2+KTnO2grZw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2920.1344035030.4697.python-list@python.org> (permalink) |
On 08/03/2012 06:41 PM, Chris Angelico wrote:
> On Sat, Aug 4, 2012 at 8:20 AM, Dave Angel <d@davea.name> wrote:
>> I'm sorry, what's not clear? Nonetype is not the same as NoneType.
>> Python is case sensitive.
> There isn't a NoneType either. I get a NameError.
>
> ChrisA
NoneType isn't in the builtin namespace. It's in the types module.
import types
a = types.Nonetype
It's still special, because None is a singleton. In any case there are
a number of places where the string "NoneType" is produced,
>>> type(None)
<type 'NoneType'>
>>> None + 3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
>>> None[3]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable
etc.
and it's in the docs, at least on page:
http://docs.python.org/library/constants.html
--
DaveA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: attribute is accessed from Nonetype Dave Angel <d@davea.name> - 2012-08-03 19:03 -0400
Re: attribute is accessed from Nonetype Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-04 01:35 +0000
Re: attribute is accessed from Nonetype Dave Angel <d@davea.name> - 2012-08-03 21:58 -0400
csiph-web