Re: Why is 'None' not assignable but 'True'/'False' are?
- From: aleax@xxxxxxxxxxxxxxxx (Alex Martelli)
- Date: Mon, 2 Jan 2006 11:23:55 -0800
Rodney Maxwell <rodney.maxwell@xxxxxxxxx> wrote:
> In Python 2.4.1:
>
> >>> None = 99
> SyntaxError: assignment to None
> >>> True = 99
> >>> False = 99
> >>> True == False
> True
> -----------------------
> So why is 'None' special?
A legacy/backwards compatibility issue: None has been there 'forever',
so that no sensible code ever had any business assigning to it; but
'False' and 'True' were introduced just a few years ago, and it was
important to not break sensible existing code doing something like
True = 1
False = 0
at the very start. In Python 3.0, when backwards compatibilities can be
introduced, True and False will become keywords (as will None); see
<http://www.python.org/peps/pep-3000.html>.
Alex
.
- Follow-Ups:
- Re: Why is 'None' not assignable but 'True'/'False' are?
- From: Antoon Pardon
- Re: Why is 'None' not assignable but 'True'/'False' are?
- References:
- Why is 'None' not assignable but 'True'/'False' are?
- From: Rodney Maxwell
- Why is 'None' not assignable but 'True'/'False' are?
- Prev by Date: Re: Python or Java or maybe PHP?
- Next by Date: Re: - E04 - Leadership! Google, Guido van Rossum, PSF
- Previous by thread: Why is 'None' not assignable but 'True'/'False' are?
- Next by thread: Re: Why is 'None' not assignable but 'True'/'False' are?
- Index(es):
Relevant Pages
|