Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.python

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-03-2012, 11:03 PM
Dave Angel
Guest
 
Posts: n/a
Default Re: attribute is accessed from Nonetype

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

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 08-04-2012, 01:35 AM
Steven D'Aprano
Guest
 
Posts: n/a
Default Re: attribute is accessed from Nonetype

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
Reply With Quote
  #3 (permalink)  
Old 08-04-2012, 01:58 AM
Dave Angel
Guest
 
Posts: n/a
Default Re: attribute is accessed from Nonetype

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

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 02:55 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.