Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python 2.4 removes None data type?

Reply
Thread Tools

Python 2.4 removes None data type?

 
 
Warren Postma
Guest
Posts: n/a
 
      03-07-2005
Michael Hoffman wrote:
> The fact that True and False are not constants?


Yowza.

a = True
b = False
False = a
True = b
if (1==2)==True:
print "Doom"
 
Reply With Quote
 
 
 
 
Warren Postma
Guest
Posts: n/a
 
      03-07-2005
Michael Hoffman wrote:
> The fact that True and False are not constants?


Yowza.

a = True
b = False
False = a
True = b
if (1==2)==True:
print "Doom"
 
Reply With Quote
 
 
 
 
Steven Bethard
Guest
Posts: n/a
 
      03-07-2005
Warren Postma wrote:
> Michael Hoffman wrote:
>
>> The fact that True and False are not constants?

>
> Yowza.
>
> a = True
> b = False
> False = a
> True = b
> if (1==2)==True:
> print "Doom"


Why stop there when you can really cause some doom:

py> import __builtin__ as bltin
py> bltin.True, bltin.False = bltin.False, bltin.True

As an example of what doom this causes, try typing it at the interactive
prompt, and then see if you can enter anything else. I can't -- the
prompt just locks up. Woo-hoo! Another way to shoot myself (and my
users) in the foot! =)

STeVe
 
Reply With Quote
 
Brian van den Broek
Guest
Posts: n/a
 
      03-07-2005
Steven Bethard said unto the world upon 2005-03-07 11:55:
> Warren Postma wrote:
>
>> Michael Hoffman wrote:
>>
>>> The fact that True and False are not constants?

>>
>>
>> Yowza.
>>
>> a = True
>> b = False
>> False = a
>> True = b
>> if (1==2)==True:
>> print "Doom"

>
>
> Why stop there when you can really cause some doom:
>
> py> import __builtin__ as bltin
> py> bltin.True, bltin.False = bltin.False, bltin.True
>
> As an example of what doom this causes, try typing it at the interactive
> prompt, and then see if you can enter anything else. I can't -- the
> prompt just locks up. Woo-hoo! Another way to shoot myself (and my
> users) in the foot! =)
>
> STeVe


Hi all,

just tried this in IDLE:

IDLE 1.1
>>> import __builtin__ as bltin
>>> bltin.True, bltin.False = bltin.False, bltin.True


>>> ================================ RESTART

================================

The restart was done by IDLE itself -- poor thing just gave up. So, it
looks like Steve has found a `commit suicide' command for an IDLE
shell

Best to all,

Brian vdB

 
Reply With Quote
 
John Machin
Guest
Posts: n/a
 
      03-07-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Sheesh... I didn't actually pull the type(None) comparison out of my
> code.


Sheesh yourself. Newsgroup readers can't do inspect.hasaclue('J. Random
Poster'); they rely on duck-typing or goose-typing.

> I was simply throwing together a possible situation. Had I
> thought about it for more than a second I would have remembered how I
> would actually use it.


Indeed.

 
Reply With Quote
 
Jacek Generowicz
Guest
Posts: n/a
 
      03-09-2005
Warren Postma <wp@tekran__NOSP7M.com> writes:

> (E-Mail Removed) wrote:
>
> > I just read in the 'What's New in Python 2.4' document that the None
> > data type was converted to a constant:
> > http://python.org/doc/2.4/whatsnew/node15.html

>
> Implication: A long standing wart in Python now gone. Its time to
> gloat. Are there any really evil glitches LEFT in Python?


Python 2.4 (#1, Dec 1 2004, 14:23:15)
[GCC 3.2.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> True, False = False, True
>>> True

False
>>>


 
Reply With Quote
 
Jarek Zgoda
Guest
Posts: n/a
 
      03-09-2005
Jacek Generowicz napisał(a):

>>Implication: A long standing wart in Python now gone. Its time to
>>gloat. Are there any really evil glitches LEFT in Python?

>
> Python 2.4 (#1, Dec 1 2004, 14:23:15)
> [GCC 3.2.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
>>>>True, False = False, True
>>>>True

>
> False


Ugh, today I've found this in some legacy code (yes, there *is* legacy
code in Python). And I will not touch this module until such syntax
become illegal.

--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
 
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
DataGrid - BorderStyle="None" and BorderWidth="None" doesn't work for Firefox David Freeman ASP .Net 8 02-16-2011 11:03 AM
Re: <var> is None vs. <var> == None Steve Holden Python 9 01-26-2009 09:10 PM
<var> is None vs. <var> == None Gerald Britton Python 7 01-24-2009 09:02 AM
testing for valid reference: obj vs. None!=obs vs. obj is not None alf Python 9 12-09-2006 05:00 AM
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Daniel Crespo Python 5 11-13-2005 12:52 PM



Advertisments