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


Groups > comp.lang.python > #64761

Re: Python declarative

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.06; 'suppose': 0.07; 'string': 0.09; 'lawrence': 0.09; 'logic': 0.09; 'parsed': 0.09; 'skip:/ 10': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'does,': 0.16; 'formula': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'grounds': 0.16; 'infinitely': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'all,': 0.19; 'file,': 0.19; 'pieces': 0.19; 'examples': 0.20; 'code,': 0.22; 'putting': 0.22; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'config': 0.24; 'instance,': 0.24; 'of.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'xml': 0.29; 'change,': 0.30; 'moved': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'piece': 0.31; 'routine': 0.31; 'file': 0.32; 'text': 0.33; 'worked': 0.33; 'charge': 0.33; "i'd": 0.34; 'something': 0.35; 'more,': 0.35; 'one,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'done': 0.36; "didn't": 0.36; 'should': 0.36; 'being': 0.38; 'files': 0.38; 'pm,': 0.38; 'anything': 0.39; 'simply': 0.61; 'times': 0.62; "you'll": 0.62; 'more': 0.64; 'afraid': 0.65; 'worth': 0.66; 'between': 0.67; '26,': 0.68; 'business': 0.70; 'hoping': 0.75; 'other.': 0.75; 'compiles': 0.84; 'fourth': 0.84; 'hardly': 0.84; 'silver': 0.84; 'edition': 0.86; 'to:none': 0.92; 'from.': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Bdymn4BL9Doc3dK6MMZU9sP3yHU4ooTfRobi6tMNKoE=; b=0IVI68pn8tyN5ekYdUDrBBo2cQobODpYjU6fx/uT7J0k9XjEIyYMHAFa0fEBBZeESZ 7Db7W34icPpX6xM1RzndQXwI7FH8//TNhmycaCeqS7bWRVtObc0enOEMqe7oLeHOnmlx A/Fy3bUEGWwGILihPJBz05nJj041F8lKZfQc4uEIFd7SI0W5kg+KPXm/RzxRTJaEE0Nu r1GvXfEZnHBx5jovHgUnUroOmJtQChg/o5u9nP4ACtdNxSN0/jCWLrnTrQsRgTFQkwxM CcW+o1N+u97V8pA5kydVAeyBFsnxa4BV/hOMQvPV3AabzOj7EH5RoDxAAEi/AE3SDywB ZX5Q==
MIME-Version 1.0
X-Received by 10.66.27.72 with SMTP id r8mr22921333pag.62.1390709175826; Sat, 25 Jan 2014 20:06:15 -0800 (PST)
In-Reply-To <lc1st6$c73$1@ger.gmane.org>
References <mailman.5529.1389805825.18130.python-list@python.org> <8fde6d34-47c5-49a1-a6d0-9ffe3df2d401@googlegroups.com> <CAPTjJmokZUHta7Y3x_=6eUjKpv2Td2iaqro1su7NuLo+gfzwag@mail.gmail.com> <lbtb9r$ljd$1@ger.gmane.org> <CAPTjJmo+EuY439wB0C8or+ZAcYeNR844HAKwL3i2+55dDE8LNA@mail.gmail.com> <lbtnft$6gf$1@ger.gmane.org> <CAPTjJmpi-kvJAVs2gK+nH5n6q3REkJaKR=CZeRfzUgDk8_VLGw@mail.gmail.com> <mailman.5968.1390634333.18130.python-list@python.org> <52e473fc$0$29999$c3e8da3$5496439d@news.astraweb.com> <lc1st6$c73$1@ger.gmane.org>
Date Sun, 26 Jan 2014 15:06:15 +1100
Subject Re: Python declarative
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.5987.1390709179.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390709179 news.xs4all.nl 2933 [2001:888:2000:d::a6]:39369
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64761

Show key headers only | View raw


On Sun, Jan 26, 2014 at 1:45 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> If I worked as a consultant I'd much prefer the XML version as I'd be able
> to charge much more on the grounds that I'd done much more, hoping that the
> people paying didn't bother with design reviews or the like :)

And that's very true. If someone wants something infinitely
customizeable, the best solution might be an empty file with a shebang
at the top - but that's hardly something you can charge oodles for.
This is where soft-coding comes from.

http://thedailywtf.com/Articles/Soft_Coding.aspx

The business logic examples given there are best served by hard code.
Suppose you need to calculate this-value plus that-value times
other-value; is there any difference between writing that in Python
(ugh, that's hard code!) and putting the formula in a config file,
where it'll get parsed and evaluated (oh, that's a config file, that's
fine)? As you'll see in my other post, there's a formula evaluator
routine there; it takes a string of code and compiles it:

(wealth_plat*1000+wealth_gold*100+wealth_silver*10+wealth_copper)/100

It's straight code, and it's embedded. If ever the rules change, I can
edit the code. For instance, here's the D&D Fourth Edition version of
that:

(wealth_plat*10000+wealth_gold*100+wealth_silver*10+wealth_copper)/100

Should the value of a platinum coin be moved out into a config file?
Maybe. MAYBE. Should the value of a silver piece be? Definitely not!
There's no use-case for silver pieces being worth anything other than
ten copper. If and when there is one, the code can simply be edited.
There is no value in soft-coding this formula.

Code isn't something to be afraid of. It's just text files like any
other. After all, Python code is a config file for /usr/bin/python, so
if you want to change what Python does, just edit its config file!

ChrisA

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


Thread

Python declarative Sergio Tortosa Benedito <sertorbe@gmail.com> - 2014-01-15 18:02 +0100
  Re: Python declarative Francesco Bochicchio <bieffe62@gmail.com> - 2014-01-17 06:22 -0800
    Re: Python declarative Francesco Bochicchio <bieffe62@gmail.com> - 2014-01-19 23:25 -0800
  Re: Python declarative sertorbe@gmail.com - 2014-01-17 06:47 -0800
    Re: Python declarative Tim Roberts <timr@probo.com> - 2014-01-18 13:13 -0800
  Re: Python declarative sertorbe@gmail.com - 2014-01-19 02:27 -0800
  Re: Python declarative sertorbe@gmail.com - 2014-01-22 12:38 -0800
  Re: Python declarative Asaf Las <roegltd@gmail.com> - 2014-01-22 13:16 -0800
    Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-23 13:29 +1100
    Re: Python declarative Terry Reedy <tjreedy@udel.edu> - 2014-01-22 23:08 -0500
    Re: Python declarative "Frank Millman" <frank@chagford.com> - 2014-01-24 11:21 +0200
      Re: Python declarative Rustom Mody <rustompmody@gmail.com> - 2014-01-24 01:53 -0800
        Re: Python declarative "Frank Millman" <frank@chagford.com> - 2014-01-24 15:06 +0200
    Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-24 22:18 +1100
    Re: Python declarative "Frank Millman" <frank@chagford.com> - 2014-01-24 14:49 +0200
    Re: Python declarative Burak Arslan <burak.arslan@arskom.com.tr> - 2014-01-24 15:40 +0200
    Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-25 00:55 +1100
    Re: Python declarative Matěj Cepl <mcepl@redhat.com> - 2014-01-24 17:28 +0100
    Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-25 03:33 +1100
      Re: Python declarative sertorbe@gmail.com - 2014-01-24 10:51 -0800
    Re: Python declarative "Frank Millman" <frank@chagford.com> - 2014-01-25 09:18 +0200
      Re: Python declarative Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-26 02:33 +0000
        Re: Python declarative Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-26 02:45 +0000
          Re: Python declarative Asaf Las <roegltd@gmail.com> - 2014-02-02 18:17 -0800
        Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-26 14:38 +1100
        Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-26 15:06 +1100
          Re: Python declarative Rustom Mody <rustompmody@gmail.com> - 2014-01-25 20:47 -0800
            Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-26 16:23 +1100
              Re: Python declarative Rustom Mody <rustompmody@gmail.com> - 2014-01-26 00:05 -0800
                Re: Python declarative "Frank Millman" <frank@chagford.com> - 2014-01-26 11:12 +0200
                Re: Python declarative Rustom Mody <rustompmody@gmail.com> - 2014-01-26 06:36 -0800
          Re: Python declarative Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-26 12:05 +0000
        Re: Python declarative "Frank Millman" <frank@chagford.com> - 2014-01-26 08:03 +0200
          Re: Python declarative Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-26 12:21 +0000
    Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-25 18:33 +1100
    Re: Python declarative matej@ceplovi.cz (Matěj Cepl) - 2014-01-25 12:23 +0100
  Re: Python declarative Asaf Las <roegltd@gmail.com> - 2014-01-24 04:04 -0800

csiph-web