Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97856
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <gandalf@shopzeus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'true,': 0.04; 'subject:Python': 0.05; '(python': 0.05; 'none,': 0.05; 'false,': 0.07; 'python': 0.10; 'languages.': 0.15; 'false:': 0.16; 'object()': 0.16; 'syntaxerror:': 0.16; 'language': 0.19; '>>>': 0.20; '"",': 0.22; 'assign': 0.22; 'constant': 0.22; 'defined': 0.23; 'seems': 0.23; 'wrote': 0.23; 'header:In-Reply-To:1': 0.24; 'question': 0.27; "can't": 0.32; 'maybe': 0.33; 'file': 0.34; 'false': 0.35; 'but': 0.36; 'keyword': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'names': 0.38; 'anything': 0.38; 'does': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'term': 0.60; 'avoid': 0.61; 'making': 0.62; 'deals': 0.67; 'skip:\xe2 10': 0.70; 'subjectcharset:utf-8': 0.71; '8bit%:40': 0.72; 'subject:have': 0.80; 'dennis': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopzeus.com; s=shopzeus_com; t=1445408017; bh=/bFzfkTF2vnbzMFzSYYHwIoIcPQ1tYz/8wE4wJ6eXgQ=; h=Subject:To:References:From:Date:In-Reply-To:From; b=Xw0tnEn0KMN7jM1vNgtbEBRAa7nLIh1d5x5fREYHzpS9YEZegWpGJNR4KYYnFR66Q bYQThtoJM6zJVNvvQmRaM38lenGKXoYMbULc40xyANd4HkCDZwOMdam66PMmjtIGec zaEKYyl2vXccWXuQD9HGrk1o6Au3rA2YKmjeSTdcR4JtuofI+i8Vmaor9wmogRaPWi uEiyDZiq3V37Lf4uLu/zLYbca5DbUfJhpu+NuVKAQNmG+n3/ObKfYBf/Y0elGvkqFz gYBM2oCz2MHV4heQLmDIqsGRFIL7lQPWMpKRTsJwEnuG/KucM/240GYCLPmdwPaOPW vKYJ6EtYirmOw== |
| Subject | Re: What does it mean for Python to have “constants”? |
| To | python-list@python.org |
| References | <q3da2bplpbt2njpoojie8ogfo7te63lhn2@4ax.com> <n04m96$tvd$1@speranza.aioe.org> <9ocd2btlkq7kp3margtn4sj3mehd7bpimm@4ax.com> <kqkd2b9gkcsdade6jlev55jpbqo7h1k4n5@4ax.com> <85twployk8.fsf_-_@benfinney.id.au> |
| From | Nagy László Zsolt <gandalf@shopzeus.com> |
| Date | Wed, 21 Oct 2015 08:13:38 +0200 |
| MIME-Version | 1.0 |
| In-Reply-To | <85twployk8.fsf_-_@benfinney.id.au> |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.69.1445408027.878.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1445408027 news.xs4all.nl 23750 [2001:888:2000:d::a6]:36554 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:97856 |
Show key headers only | View raw
Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:
>> (Python does not have anything that one might consider a true constant
>> -- other than the language defined singletons: None, and maybe by now
>> True and False).
> Python now deals with those by making the names keywords::
>
> >>> True = object()
> File "<stdin>", line 1
> SyntaxError: can't assign to keyword
> >>> False = object()
> File "<stdin>", line 1
> SyntaxError: can't assign to keyword
> >>> None = object()
> File "<stdin>", line 1
> SyntaxError: can't assign to keyword
>
> which seems to rather avoid the question of whether they are “constants”
> as would be understood by newcomers experienced with that term in other
> languages.
>
This is true for Python 3, but the OP wrote his program in Python 2. In
Python 2, you can do this (unfortunately):
>>> True, False = False, True
>>> if False:
... print("DOH!")
...
DOH!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
variable scope of class objects JonRob - 2015-10-19 14:39 -0400
Re: variable scope of class objects Random832 <random832@fastmail.com> - 2015-10-19 15:01 -0400
Re: variable scope of class objects JonRob - 2015-10-20 17:11 -0400
Re: variable scope of class objects sohcahtoa82@gmail.com - 2015-10-19 16:19 -0700
Re: variable scope of class objects Terry Reedy <tjreedy@udel.edu> - 2015-10-19 20:03 -0400
Re: variable scope of class objects Nagy László Zsolt <gandalf@shopzeus.com> - 2015-10-20 07:31 +0200
Re: variable scope of class objects Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-10-20 08:17 +0200
Re: variable scope of class objects Nagy László Zsolt <gandalf@shopzeus.com> - 2015-10-20 08:38 +0200
Re: variable scope of class objects Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-10-20 09:23 +0200
Re: variable scope of class objects JonRob - 2015-10-20 17:33 -0400
Re: variable scope of class objects Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-10-20 20:18 -0400
Re: variable scope of class objects JonRob - 2015-10-21 19:35 -0400
Re: variable scope of class objects Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-10-22 11:59 +0200
What does it mean for Python to have “constants”? (was: variable scope of class objects) Ben Finney <ben+python@benfinney.id.au> - 2015-10-21 11:27 +1100
Re: What does it mean for Python to have “constants”? Nagy László Zsolt <gandalf@shopzeus.com> - 2015-10-21 08:13 +0200
Re: variable scope of class objects Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-10-22 07:55 +0200
Re: variable scope of class objects Erik <python@lucidity.plus.com> - 2015-10-20 23:17 +0100
csiph-web