Sujet : Re: Command Languages Versus Programming Languages
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 08. Apr 2024, 23:14:16
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uv1q7n$3oohj$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On Mon, 8 Apr 2024 08:20:37 -0700, John Ames wrote:
... compulsively indenting and
splitting across lines can get out of hand, too. It seems to me that a
lot of people in this age of "cinematic" aspect ratios and super-sized
displays in personal computing forget that eye-travel isn't free, and
spreading information across maximal space can make it *harder* to keep
track of context.
There it is again: “maximal space”. The “space” is there to be used.
Code may be one-dimensional, but you have a two-dimensional screen to
display it, why not make use of that, if it makes a complex structure
clearer?
Another example:
def fill_in_depreciations(tax_year) :
"(re)inserts depreciation entries for the specified tax year," \
" based on currently-entered assets."
sql.cursor.execute \
(
"delete from payments where kind = %s and tax_year = %s",
["D", tax_year]
)
for \
entry \
in \
get_each_record \
(
table_name = "assets, asset_depreciations",
fields =
[
"assets.description as description",
"assets.initial_value as initial_value",
"assets.when_purchased as when_purchased",
"assets.depreciation_rate as rate",
"assets.depreciation_method as method",
"asset_depreciations.depreciation_amount as amount",
],
condition =
"assets.asset_id = asset_depreciations.asset_id and"
" asset_depreciations.tax_year = %s",
values = [tax_year]
) \
:
sql.cursor.execute \
(
"insert into payments set when_made = %(when_made)s,"
" description = %(description)s, other_party_name = \"\","
" amount = %(amount)d, kind = \"D\", tax_year = %(tax_year)d"
%
{
"when_made" : end_for_tax_year(tax_year) - 1,
"description" :
sql_string
(
"%s: %s $%s at %d%% from %s"
%
(
entry["description"],
entry["method"],
format_amount(entry["initial_value"]),
entry["rate"],
format_date(entry["when_purchased"]),
)
),
"amount" : - entry["amount"],
"tax_year" : tax_year,
}
)
#end for
#end fill_in_depreciations