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

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

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
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

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

On Sat, 04 Aug 2012 08:41:20 +1000, 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.


Shame on you :-P

Ramit Prasad showed exactly how you can see NoneType in action in the
part of the post you snipped from your reply.

py> len(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object of type 'NoneType' has no len()


NoneType *is* a standard type. It's just not bound to a publicly
accessible name in the built-ins. But you can easily get access to the
class using either:

type(None)
None.__class__

or in Python 2.6 at least,

import types
types.NoneType

(although it has been removed from Python 3.2 for some reason).



--
Steven
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 07:19 PM.


Copyright ©2009

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