On Apr 28, 4:05 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
John Nagle [EMAIL PROTECTED] wrote:
I'd have to consider that a bug.
Some very early FORTRAN compilers allowed you to redefine
integer constants:
CALL SET(25,99)
WRITE (6,100) 25
100 FORMAT(I6)
Beliavsky [EMAIL PROTECTED] wrote:
...
If this has changed in the Fortran 1990 standard or later, then I can
only say I'm happy I stopped using Fortran heavily before such standards
became widespread in commonly available compilers -- by the late '90s,
when I was still using
Newbie question:
Why is 1 == True and 2 == True (even though 1 != 2),
but 'x' != True (even though if 'x': works)?
--
http://mail.python.org/mailman/listinfo/python-list
Szabolcs wrote:
Why is 1 == True and 2 == True (even though 1 != 2),
Not what I get.
Python 2.5 (r25:51908, Mar 13 2007, 08:13:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type help, copyright, credits or license for more information.
2 == True
False
--
Michael
Szabolcs wrote:
Newbie question:
Why is 1 == True and 2 == True (even though 1 != 2),
but 'x' != True (even though if 'x': works)?
Please check before you post:
[E:\Projects]python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type help, copyright,
On Sat, 28 Apr 2007 14:33:23 +0200, Szabolcs wrote:
Newbie question:
Why is 1 == True and 2 == True (even though 1 != 2),
but 'x' != True (even though if 'x': works)?
Everything in Python has a truth-value. So you can always do this:
if some_object:
print if clause is true
else:
Steven D'Aprano wrote:
1 == True
True
0 == False
True
2 == True
False
Oh my goodness! Now I also get 2 != True. I really don't know what
happened. Most probably this (as a result of mistyping):
True = 2 # DON'T DO THIS!!!
2 == True
True
But shouldn't Python forbid this? Is it
On Sat, 28 Apr 2007 15:36:19 +0200, Szabolcs wrote:
True = 2 # DON'T DO THIS!!!
2 == True
True
But shouldn't Python forbid this? Is it possible to get a warning when
unintentionally redefining built-in thing?
Python forbids very few things in comparison to other languages. The
Szabolcs [EMAIL PROTECTED] wrote:
...
True = 2 # DON'T DO THIS!!!
2 == True
True
But shouldn't Python forbid this? Is it possible to get a warning when
unintentionally redefining built-in thing?
Python can be changed to make some non-reserved builtin identifiers into
reserved words,
Steven D'Aprano wrote:
On Sat, 28 Apr 2007 15:36:19 +0200, Szabolcs wrote:
True = 2 # DON'T DO THIS!!!
2 == True
True
But shouldn't Python forbid this? Is it possible to get a warning when
unintentionally redefining built-in thing?
Python forbids very few things in comparison to
John Nagle [EMAIL PROTECTED] wrote:
...
I'd have to consider that a bug.
Some very early FORTRAN compilers allowed you to redefine
integer constants:
CALL SET(25,99)
WRITE (6,100) 25
100 FORMAT(I6)
SUBROUTINE SET(IVAR, INEWVAL)
IVAR =
Alex Martelli wrote:
Maybe somebody assigning a value to True or False is a
common error, but much of my livelihood over the last 10 years has been
about mentoring/coaching programmers in Python, and that's one error I
have *NEVER* observed, so I'd need a lot of empirical evidence to
convince
John Nagle wrote:
True, False, and None should be reserved words in Python.
None already is.
The permissiveness makes it less painful to upgrade to new versions of
Python. True and False only recently got assigned conventional
values, but you can still import old modules without
On Sat, 28 Apr 2007 11:35:36 -0700, John Nagle wrote:
Python forbids very few things in comparison to other languages. The
attitude is We're all adults here. Because Python is such a dynamic
language, it is often hard for the compiler to tell the difference between
something you are doing
On Sat, 28 Apr 2007 23:54:01 +0200, Szabolcs wrote:
But I still think that it is an inconsistency to allow to redefine a
_value_ like True or False (not a built-in function that may have been
missing in earlier versions). Saying True = 2 is just like saying 3 = 2.
Well, it might seem that
Szabolcs [EMAIL PROTECTED] wrote:
But I still think that it is an inconsistency to allow to redefine a
_value_ like True or False (not a built-in function that may have been
missing in earlier versions). Saying True = 2 is just like saying 3 = 2.
True and False were *ALSO* missing in earlier
16 matches
Mail list logo