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


Groups > comp.lang.python > #26460 > unrolled thread

Re: attribute is accessed from Nonetype

Started byDave Angel <d@davea.name>
First post2012-08-03 19:03 -0400
Last post2012-08-03 21:58 -0400
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#26460 — Re: attribute is accessed from Nonetype

FromDave Angel <d@davea.name>
Date2012-08-03 19:03 -0400
SubjectRe: attribute is accessed from Nonetype
Message-ID<mailman.2920.1344035030.4697.python-list@python.org>
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

[toc] | [next] | [standalone]


#26465

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-04 01:35 +0000
Message-ID<501c7c71$0$29978$c3e8da3$5496439d@news.astraweb.com>
In reply to#26460
On Fri, 03 Aug 2012 19:03:20 -0400, Dave Angel wrote:

> 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
                ^^^^^^^^

Oh the irony. After criticising a beginner for getting the case wrong, 
you have done exactly the same thing.

A form of Muphry's Law (the Iron Law of Nitpicking) perhaps?

http://en.wikipedia.org/wiki/Muphry%27s_law



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#26466

FromDave Angel <d@davea.name>
Date2012-08-03 21:58 -0400
Message-ID<mailman.2921.1344045542.4697.python-list@python.org>
In reply to#26465
On 08/03/2012 09:35 PM, Steven D'Aprano wrote:
> On Fri, 03 Aug 2012 19:03:20 -0400, Dave Angel wrote:
>
>> 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
>                 ^^^^^^^^
>
> Oh the irony. After criticising a beginner for getting the case wrong, 
> you have done exactly the same thing.
>
> A form of Muphry's Law (the Iron Law of Nitpicking) perhaps?
>
> http://en.wikipedia.org/wiki/Muphry%27s_law
>
You are, of course right;  I blew it.  Thanks for pointing it out with
humor.


-- 

DaveA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web