Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76867

Re: Simple question

From Peter Otten <__peter__@web.de>
Subject Re: Simple question
Date 2014-08-23 15:26 +0200
Organization None
References <ca0167cc-49d3-4e58-9fc0-e80550ee2bcf@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.13341.1408800422.18130.python-list@python.org> (permalink)

Show all headers | View raw


explodeandroid@gmail.com wrote:

> Can some one explain why this happens:
> True, False = False, True
> print True, False
> False True

You are using Python 2 where True/False are names that can be rebound. This 
is for backwards compatibility as Python didn't always have booleans and 
people made their own with

True = 1
False = 0

or similar.

In Python 3 True and False are keywords:

>>> True = False
  File "<stdin>", line 1
SyntaxError: can't assign to keyword

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Simple question explodeandroid@gmail.com - 2014-08-23 06:10 -0700
  Re: Simple question Chris Angelico <rosuav@gmail.com> - 2014-08-23 23:19 +1000
  Re: Simple question Peter Otten <__peter__@web.de> - 2014-08-23 15:26 +0200
  Re: Simple question "ElChino" <elchino@cnn.cn> - 2014-08-23 15:31 +0200
  Re: Simple question John Ladasky <john_ladasky@sbcglobal.net> - 2014-08-23 22:55 -0700
    Re: Simple question Chris Angelico <rosuav@gmail.com> - 2014-08-24 16:22 +1000

csiph-web