Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: None, False, True

Reply
Thread Tools

RE: None, False, True

 
 
Pettersen, Bjorn S
Guest
Posts: n/a
 
      09-16-2003
> From: M-a-S [(E-Mail Removed)]
>
> Can anybody explain this:


sure.

> Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.


You're running Python 2.3 on a windows os.

> >>>
> >>> None = 3


you're assigning the value 3 to the name 'None'

> <stdin>:1: SyntaxWarning: assignment to None


the compiler warns you that 'None' is a special name that you probably
don't want to rebind.

> >>> False = 4


you assign the value 4 to the name 'False'

> >>> True = 5


you assign the value 5 to the name 'True'

> >>> None, False, True

> (3, 4, 5)


The interpreter prints the value of the tuple you entered.

Which part of this didn't you understand? (my mind-reading skills are
too rusty to determine if you think this shouldn't happen for some
reason...)

-- bjorn

 
Reply With Quote
 
 
 
 
Asun Friere
Guest
Posts: n/a
 
      09-17-2003
"Pettersen, Bjorn S" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> > From: M-a-S [(E-Mail Removed)]
> > >>> None = 3

>
> you're assigning the value 3 to the name 'None'
>
> > <stdin>:1: SyntaxWarning: assignment to None

>
> the compiler warns you that 'None' is a special name that you probably
> don't want to rebind.
>


Actually the compiler warns you that 'None' is s special name that you
probably _didn't_ want to rebind. But you have. As you can see, the
compiler doesn't issue such warnings with regard to 'True' and
'False.' Does that explain it?

>>>def spam(): pass

....
>>>None = spam()

<stdin>:1: SyntaxWarning: assignment to None
>>>False = bool(spam())
>>>True = bool(spam)
>>>(None, False, True)

(None, False, True)

all fixed now %)
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[False,True] and [True,True] --> [True, True]????? bdb112 Python 45 04-29-2009 02:35 AM
"0 in [True,False]" returns True Pierre Quentel Python 59 12-16-2005 01:47 PM
TurboGears /.-ed, >new == True< or >new == "True"< Andy Leszczynski Python 4 10-13-2005 06:56 AM
C and C++ are interoperable languages? True or Not True? Chip C++ 6 01-08-2005 11:10 PM
Does true ^ true return false? Siemel Naran C++ 19 06-18-2004 11:06 AM



Advertisments