| Deutsch English Français Italiano |
|
<shorter-20231107093650@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Python Golf
Date: 7 Nov 2023 08:37:29 GMT
Organization: Stefan Ram
Lines: 16
Expires: 1 Dec 2024 11:59:58 GMT
Message-ID: <shorter-20231107093650@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de WUTWXtkCnu36BiJFVu2CRA+NpRHc90XkvZFS5lrhqdyoTc
Cancel-Lock: sha1:QZHYk3xh/E4MrWnOEy/PD7iev8U= sha256:SrEe3ico9Pu2UktVIfX/XMqDUGo8TgortJAkP02+kUE=
X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
I read this in a shell newsgroup:
perl -anE '$s += $F[1]; END {say $s}' in
, so I wrote
py -c "import sys; print(sum(int(F.split()[1])for F in sys.stdin))" <in
to show that this is possible with Python too.
But now people complain that it's longer than the Perl version.
Do you see ways to make it shorter (beyond removing one space
after the semicolon ";")?