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


Groups > comp.lang.python > #8291

Re: python 3 constant

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!news.osn.de!diablo2.news.osn.de!news.belwue.de!news.uni-stuttgart.de!news.nask.pl!news.nask.org.pl!nf1.ipartners.pl!ipartners.pl!news2.ipartners.pl!not-for-mail
From "Waldek M." <wm@localhost.localdomain>
Newsgroups comp.lang.python
Subject Re: python 3 constant
Date Thu, 23 Jun 2011 13:58:08 +0200
Organization Mojito.pl
Lines 30
Message-ID <eszp4cvoh5fb.dlg@localhost.localdomain> (permalink)
References <927fca1e-ca72-4d33-965c-70b812b83d50@glegroupsg2000goo.googlegroups.com> <mailman.301.1308777491.1164.python-list@python.org> <192j4fjo2gskg$.dlg@localhost.localdomain> <87y60tnhaa.fsf@benfinney.id.au>
NNTP-Posting-Host 89.174.106.129
Mime-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 8bit
X-Trace news2.ipartners.pl 1308830282 78592 89.174.106.129 (23 Jun 2011 11:58:02 GMT)
X-Complaints-To abuse@ipartners.pl
NNTP-Posting-Date 23 Jun 2011 11:58:02 GMT
X-Antivirus avast! (VPS 110623-0, 2011-06-23), Outbound message
X-Antivirus-Status Clean
User-Agent 40tude_Dialog/2.0.15.1pl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8291

Show key headers only | View raw


Dnia Thu, 23 Jun 2011 17:22:37 +1000, Ben Finney napisał(a):
> If you mean creating a binding which can't be re-bound: −1.

Perhaps. Or perhaps that could be done in some other fashion;
I admit that I usually stick to more strict languages
and while Python's flexibility is great... I'm really missing
constants.

> The ability to re-bind any attribute, even ones which the author thought
> should be constant, makes writing unit tests much easier. I don't see
> that putative benefits of constant bindings would be anywhere near as
> valuable.

Primo, isn't it usually the author that does the unit testing?
Anyway, correct me if I'm wrong but I always thought that unit tests
should prove the correctness and quality of the code under test,
and not the other way around, which would be sacrifising
code security to make testing easier.

Secundo, one can say that re-binding gives the freedom to change
what one likes; I'd say that I'd also like the freedom to decide what
is mutable and what is not.

Of course, it is just my personal opinion. It might be not pythonic,
I may be wrong, yet - concept of constants is not something new and
if other languages, like C/C++/Java/Perl/ (bash even) have them, 
I can't see the reason not to have them in Python.

Best regards,
Waldek

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


Thread

python 3 constant sidRo <slacky2005@gmail.com> - 2011-06-22 11:54 -0700
  Re: python 3 constant Noah Hall <enalicho@gmail.com> - 2011-06-22 22:17 +0100
    Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-23 08:40 +0200
      Re: python 3 constant Ben Finney <ben+python@benfinney.id.au> - 2011-06-23 17:22 +1000
        Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-23 13:58 +0200
          Re: python 3 constant Ben Finney <ben+python@benfinney.id.au> - 2011-06-23 23:04 +1000
            Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-25 12:42 +0200
          Re: python 3 constant Chris Angelico <rosuav@gmail.com> - 2011-06-24 01:29 +1000
            Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-23 21:56 +0200
              Re: python 3 constant Chris Angelico <rosuav@gmail.com> - 2011-06-24 08:00 +1000
                Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-25 12:50 +0200
                Re: python 3 constant Chris Angelico <rosuav@gmail.com> - 2011-06-25 20:59 +1000
                Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-25 13:24 +0200
              Re: python 3 constant alex23 <wuwei23@gmail.com> - 2011-06-23 20:04 -0700
                Re: python 3 constant "Waldek M." <wm@localhost.localdomain> - 2011-06-25 12:44 +0200

csiph-web