Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Thank heaven for startups; without them we'd never have any advances." -- Seymour Cray


devel / comp.lang.python / Re: Python Dialogs

SubjectAuthor
* Python DialogsStefan Ram
+* Re: Python DialogsLoris Bennett
|+- Re: Python DialogsPeter J. Holzer
|+* Re: Python DialogsStefan Ram
||+* Re: Python DialogsStefan Ram
|||`- Re: Python Dialogsjak
||`- Re: Python Dialogs (Posting On Python-List Prohibited)Lawrence D'Oliveiro
|`* Re: Python Dialogsjak
| `- Re: Python DialogsChris Angelico
`* Re: Python Dialogs (Posting On Python-List Prohibited)Lawrence D'Oliveiro
 `- Re: Python Dialogs (Posting On Python-List Prohibited)Alan Bawden

1
Python Dialogs

<dialog-20240502150909@ram.dialup.fu-berlin.de>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25450&group=comp.lang.python#25450

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.quux.org!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Python Dialogs
Date: 2 May 2024 14:23:19 GMT
Organization: Stefan Ram
Lines: 41
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <dialog-20240502150909@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 DH6XgNXg+yO/zChxBoB+yAmfNwDP2WoupUToXLr/7skvod
Cancel-Lock: sha1:9P/EqVxogQ8CIbQaWTkL/T1aL64= sha256:XBauTi2w6M56vtpScXmRzGJ6EhzJ2cjRtxWfl+Ob6Rc=
X-Copyright: (C) Copyright 2024 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
 by: Stefan Ram - Thu, 2 May 2024 14:23 UTC

Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!

Assume you have an expression "s.replace('a','b').replace('c','d').
replace('e','f').replace('g','h')". Its value is a string which
is the value of s, but with "a" replaced by "b", "c" replaced by
"d", "e" replaced by "f" and "g" replaced by "h". How to modify
this expression, so that "a", "c", "e", and "g", respectively,
are replaced only if they are words (but not parts of words)?

import re

s.replace(r"\ba\b", "b").replace(r"\bc\b", "d").replace(r"\be\b", "f").replace(r"\bg\b", "h")

No. "replace" will not use regular expressions, even if you write
"import re".

import re

s = re.sub(r"\ba\b", "b", s)
s = re.sub(r"\bc\b", "d", s)
s = re.sub(r"\be\b", "f", s)
s = re.sub(r"\bg\b", "h", s)

Now you give me a sequence of four statements, but I need an
expression!

s = re.sub(r"\ba\b", "b", re.sub(r"\bc\b", "d", re.sub(r"\be\b", "f", re.sub(r"\bg\b", "h", s))))

Yeah, that's an expression, but it's kind of nested I guess.
Can you write another expression with less nesting?

s = re.sub(r"\ba\b|\bc\b|\be\b|\bg\b", lambda x: {"a": "b", "c": "d", "e": "f", "g": "h"}[x.group()], s)

Nice idea! Only drawback is that to add another word, you gotta
modify in two places.

replacements = {"a": "b", "c": "d", "e": "f", "g": "h"}
s = re.sub(r"\b(" + "|".join(replacements.keys()) + r")\b", lambda x: replacements[x.group()], s)

PS: This is for the script I use to send posts. So if you do not
see "trying to" (5 letters: "t-r-y-n-a") here, it kind of worked!

Re: Python Dialogs

<87frv02sg1.fsf@zedat.fu-berlin.de>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25451&group=comp.lang.python#25451

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.nntp4.net!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: loris.be...@fu-berlin.de (Loris Bennett)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: Thu, 02 May 2024 16:34:38 +0200
Organization: FUB-IT (ex-ZEDAT), Freie Universität Berlin
Lines: 13
Message-ID: <87frv02sg1.fsf@zedat.fu-berlin.de>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: news.uni-berlin.de rvAOt3JCU7diby7N4pzoow4kPSORYr4K43uRaJ9VLFLTIP
Cancel-Lock: sha1:6pln4xHwX+DJ5aL+hQLwbxwh5jw= sha1:EFN9kO2HOjfH+cUPte0IiloTtwc= sha256:jvXJ/4lC9uZM/SV21Xg0Ss/fETG8BOFVynYkz/wcRhA=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
 by: Loris Bennett - Thu, 2 May 2024 14:34 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:

> Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!

Is there a name for this kind of indentation, i.e. the stuff you are
writing not being flush left? It is sort of contrary to
what I think of as "normal" indentation. You seem to use it in all your
postings, too, which hurts my brain, but I guess that's my problem :-)

[snip (40 lines)]

--
This signature is currently under constuction.

Re: Python Dialogs (Posting On Python-List Prohibited)

<v11gkh$9q5g$2@dont-email.me>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25452&group=comp.lang.python#25452

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs (Posting On Python-List Prohibited)
Date: Fri, 3 May 2024 02:02:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <v11gkh$9q5g$2@dont-email.me>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 03 May 2024 04:02:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cfd0dd0a0e9abee8835016bed2d05754";
logging-data="321712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18InmHwPNYLad0IzpunzP+f"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:iZNKPiq7tPGCvS+EqJyEabYwUO0=
 by: Lawrence D'Oliv - Fri, 3 May 2024 02:02 UTC

> Assume you have an expression "s.replace('a','b').replace('c','d').
> replace('e','f').replace('g','h')". Its value is a string which
> is the value of s, but with "a" replaced by "b", "c" replaced by
> "d", "e" replaced by "f" and "g" replaced by "h". How to modify
> this expression, so that "a", "c", "e", and "g", respectively,
> are replaced only if they are words (but not parts of words)?

import re

replacements = (("a", "b"), ("c", "d"), ("e", "f"), ("g", "h"))

text = "this be a test g eg"

"".join \
(
repl.get(s, s)
for repl in (dict(replacements),)
for s in
re.split("\\b(" + "|".join(re.escape(s[0]) for s in replacements) + ")\\b", text)
)

result:

'this be b test h eg'

Re: Python Dialogs (Posting On Python-List Prohibited)

<86v83vmkks.fsf@williamsburg.bawden.org>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25453&group=comp.lang.python#25453

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bawden.eternal-september.org!.POSTED!not-for-mail
From: ala...@csail.mit.edu (Alan Bawden)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs (Posting On Python-List Prohibited)
Date: Fri, 03 May 2024 03:16:35 -0400
Organization: ITS Preservation Society
Lines: 35
Message-ID: <86v83vmkks.fsf@williamsburg.bawden.org>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<v11gkh$9q5g$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Fri, 03 May 2024 09:16:38 +0200 (CEST)
Injection-Info: bawden.eternal-september.org; posting-host="8c1c5e363e6bcb94508491a3ca9524fb";
logging-data="445037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18igSM1+++rc9yECGptu9fX"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock: sha1:jARFzP3uSlY0SPhG+94F2WZXSVg=
sha1:jkOh6o3xX8ODN1wqBNEMNb1uAcM=
 by: Alan Bawden - Fri, 3 May 2024 07:16 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:

> Assume you have an expression "s.replace('a','b').replace('c','d').
> replace('e','f').replace('g','h')". Its value is a string which
> is the value of s, but with "a" replaced by "b", "c" replaced by
> "d", "e" replaced by "f" and "g" replaced by "h". How to modify
> this expression, so that "a", "c", "e", and "g", respectively,
> are replaced only if they are words (but not parts of words)?

import re

replacements = (("a", "b"), ("c", "d"), ("e", "f"), ("g", "h"))

text = "this be a test g eg"

"".join \
(
repl.get(s, s)
for repl in (dict(replacements),)
for s in
re.split("\\b(" + "|".join(re.escape(s[0]) for s in replacements) + ")\\b", text)
)

How about just:

repl = {
"a" : "b",
"c" : "d",
"e" : "f",
"g" : "h",
}

"".join(repl.get(s, s) for s in re.split(r"\b", text))

- Alan

Re: Python Dialogs

<mailman.7.1714853188.3326.python-list@python.org>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25465&group=comp.lang.python#25465

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: Sat, 4 May 2024 22:00:02 +0200
Lines: 48
Message-ID: <mailman.7.1714853188.3326.python-list@python.org>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de>
<20240504200002.fugyv4rd34dvapeg@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="tg3yrqlf7hlyhlzx"
X-Trace: news.uni-berlin.de 3J8Q42w3+7nYjRkV47P6jgOqk5SMf6CzBztoVQqbhRFg==
Cancel-Lock: sha1:i9TnOhLusLcvGWH9MGCCSZa1J9I= sha256:YKsjqswN8AXDU6eiR24ORi58x3ib1rCWTIfSAZL4+Pg=
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; 'content-type:application/pgp-
signature': 0.09; 'filename:fname piece:asc': 0.09;
'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; 'writes:': 0.09;
'subject:Python': 0.12; '"creative': 0.16; '+0200,': 0.16; '__/':
0.16; 'bennett': 0.16; 'challenge!"': 0.16; 'contrary': 0.16;
'from:addr:hjp-python': 0.16; 'from:addr:hjp.at': 0.16;
'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16; 'holzer':
0.16; 'reality.': 0.16; 'stross,': 0.16; 'url-ip:212.17.106/24':
0.16; 'url-ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16;
'wrote:': 0.16; 'to:addr:python-list': 0.20; 'i.e.': 0.22;
'lines': 0.23; 'stuff': 0.25; 'stefan': 0.26; 'sense': 0.28;
'think': 0.32; 'python-list': 0.32; 'there': 0.33; 'header:In-
Reply-To:1': 0.34; 'received:212': 0.62; 'everything': 0.63;
'well': 0.65; 'received:userid': 0.66; 'url-ip:212/8': 0.69;
'known': 0.84; 'received:at': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <87frv02sg1.fsf@zedat.fu-berlin.de>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <20240504200002.fugyv4rd34dvapeg@hjp.at>
X-Mailman-Original-References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de>
 by: Peter J. Holzer - Sat, 4 May 2024 20:00 UTC
Attachments: signature.asc (application/pgp-signature)

On 2024-05-02 16:34:38 +0200, Loris Bennett via Python-list wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
> > Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!
>
> Is there a name for this kind of indentation, i.e. the stuff you are
> writing not being flush left?

Ramism.

> It is sort of contrary to what I think of as "normal" indentation.

Stefan is well known for doing everything contrary to normal convention.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: Python Dialogs

<spaces-20240506123628@ram.dialup.fu-berlin.de>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25468&group=comp.lang.python#25468

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!rocksolid2!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: 6 May 2024 11:43:01 GMT
Organization: Stefan Ram
Lines: 17
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <spaces-20240506123628@ram.dialup.fu-berlin.de>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de> <87frv02sg1.fsf@zedat.fu-berlin.de> <v1acge$2h0qo$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de XPbNwyJ7e4Xn6b56nwBE6A3SyoqC6l1VZe1Lhvantu8b51
Cancel-Lock: sha1:/0Q+zJZBpj30vR3dYodAUl/UO3g= sha256:u8y5Ycv72RGVvQgfhb5BrXA2n0DUx5+jcnxG4eqJc70=
X-Copyright: (C) Copyright 2024 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
 by: Stefan Ram - Mon, 6 May 2024 11:43 UTC

jak <nospam@please.ty> wrote or quoted:
>complex, I happen to use Google-Translator. It makes bad translations if
>the lines are interrupted by the newline, so I wrote a tool dedicated to
>Stefan and to all those who indent like him. This tool takes the text
>from the clipboard, removes all the superfluous spaces, combines all the
>lines in one and puts the result back into the clipboard. :-D

The game-changer is using "Content-Type: text/plain" instead
of "Content-Type: text/plain; format=flowed", because some
translation services are gonna interpret line breaks as
paragraph endings! But extra spaces like this should
just get ignored by most translation services.

We usually set off quotes, like code snippets, by indenting them.
Well, that won't fly in Python because indentation actually affects
the code's meaning. That's why in Python newsgroups, we got to do the
opposite - indent the surrounding text to make the quotes stand out!

Re: Python Dialogs

<v1acge$2h0qo$1@dont-email.me>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25469&group=comp.lang.python#25469

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: Mon, 6 May 2024 12:47:43 +0200
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <v1acge$2h0qo$1@dont-email.me>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 06 May 2024 12:47:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b67e37e57a13f30a7c27c16f1d59e3e8";
logging-data="2655064"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Vv8grcaNZZBIWlFLn0ZzU"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.2
Cancel-Lock: sha1:DFveLBLuOxYSNh5rUY37ORYbofA=
In-Reply-To: <87frv02sg1.fsf@zedat.fu-berlin.de>
 by: jak - Mon, 6 May 2024 10:47 UTC

Loris Bennett ha scritto:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>
>> Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!
>
> Is there a name for this kind of indentation, i.e. the stuff you are
> writing not being flush left? It is sort of contrary to
> what I think of as "normal" indentation. You seem to use it in all your
> postings, too, which hurts my brain, but I guess that's my problem :-)
>
> [snip (40 lines)]
>

It's not just your problem. When the texts are particularly long and
complex, I happen to use Google-Translator. It makes bad translations if
the lines are interrupted by the newline, so I wrote a tool dedicated to
Stefan and to all those who indent like him. This tool takes the text
from the clipboard, removes all the superfluous spaces, combines all the
lines in one and puts the result back into the clipboard. :-D

Re: Python Dialogs

<v1aomd$2jsbp$1@dont-email.me>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25470&group=comp.lang.python#25470

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: Mon, 6 May 2024 16:15:41 +0200
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <v1aomd$2jsbp$1@dont-email.me>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de> <v1acge$2h0qo$1@dont-email.me>
<spaces-20240506123628@ram.dialup.fu-berlin.de>
<gonna-20240506140618@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 06 May 2024 16:15:41 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="fa2dbc4125fee46b801fdffab1560af6";
logging-data="2748793"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18E48EzOuwgXFbRHiPED4FU"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.2
Cancel-Lock: sha1:tfXRerk57gr6RRJKp358Qnf87hE=
In-Reply-To: <gonna-20240506140618@ram.dialup.fu-berlin.de>
 by: jak - Mon, 6 May 2024 14:15 UTC

Stefan Ram ha scritto:
> ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
>> translation services are gonna interpret line breaks as
>
> I just beefed up my posting program to replace "gonna".
>
> Now I won't come across like some street thug, but rather
> as a respectable member of human society!
>
> # replace complete words
> replacements =\
> { rb'kind of': b'kind of',
> rb'trying to': b'trying to',
> rb'got to': b'got to',
> rb'gonna': b'going to',
> }
> lines =\
> [ re.sub( rb"\b(" + b"|".join( replacements.keys() ) + rb")\b",
> lambda x: replacements[ x.group() ], line )
> if len( line )and line[ 0 ]not in b'>|' else line for line in lines ]
>

I present to you the brutality to which your posts are subjected:

for(d = s = pCLipb; *s != TEXT('\0'); s++)
{
if(d == pCLipb)
{
if(*s != TEXT(' ') && *s != TEXT('\n') && *s != TEXT('\r'))
*d++ = *s;
}
else if(*s == TEXT(' ') || *s == TEXT('\n') || *s == TEXT('\r'))
{
if(d[-1] != TEXT(' '))
*d++ = TEXT(' ');
}
else
*d++ = *s;
}
*d = TEXT('\0');

Re: Python Dialogs

<gonna-20240506140618@ram.dialup.fu-berlin.de>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25471&group=comp.lang.python#25471

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.network!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: 6 May 2024 13:07:55 GMT
Organization: Stefan Ram
Lines: 19
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <gonna-20240506140618@ram.dialup.fu-berlin.de>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de> <87frv02sg1.fsf@zedat.fu-berlin.de> <v1acge$2h0qo$1@dont-email.me> <spaces-20240506123628@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 Ta16+rwNNrVZraiaayoLIgXDOTQpxj8JOK/Jq3Pj9Xz24R
Cancel-Lock: sha1:h+uVHP/xPKX6Ru/Bp47HTnP/0Qo= sha256:+CW2sF5KYdSqnguxRtt5PtBHojzS+ACfiv9wSgECstc=
X-Copyright: (C) Copyright 2024 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
 by: Stefan Ram - Mon, 6 May 2024 13:07 UTC

ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
>translation services are gonna interpret line breaks as

I just beefed up my posting program to replace "gonna".

Now I won't come across like some street thug, but rather
as a respectable member of human society!

# replace complete words
replacements =\
{ rb'kind of': b'kind of',
rb'trying to': b'trying to',
rb'got to': b'got to',
rb'gonna': b'going to',
}
lines =\
[ re.sub( rb"\b(" + b"|".join( replacements.keys() ) + rb")\b",
lambda x: replacements[ x.group() ], line )
if len( line )and line[ 0 ]not in b'>|' else line for line in lines ]

Re: Python Dialogs

<mailman.11.1715017712.3326.python-list@python.org>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25474&group=comp.lang.python#25474

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs
Date: Tue, 7 May 2024 03:48:19 +1000
Lines: 29
Message-ID: <mailman.11.1715017712.3326.python-list@python.org>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de> <v1acge$2h0qo$1@dont-email.me>
<CAPTjJmq00N_zrP22VGJvhju8S8uvH+aQQZgD9Sx=2O9pr2VQzQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 3itE1grWi8HfarDHtscwiQfJZULstXRiGDgHEry82+/Q==
Cancel-Lock: sha1:2ooMECqE72g0W0MZzBGksLOrOTU= sha256:kE0sZWt7JfW8gt3MXkDVVOBQxnbGBifLxJjQZsz/LrU=
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=VzaSP7zu;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.027
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; ':-)': 0.09;
'translations': 0.09; 'writes:': 0.09; 'subject:Python': 0.12;
'problem.': 0.15; '2024': 0.16; 'bennett': 0.16; 'chrisa': 0.16;
'combines': 0.16; 'contrary': 0.16; 'from:addr:rosuav': 0.16;
'from:name:chris angelico': 0.16; 'interrupted': 0.16; 'removes':
0.16; 'wrote:': 0.16; 'problem': 0.16; 'tue,': 0.19; 'to:addr
:python-list': 0.20; 'i.e.': 0.22; 'lines': 0.23; 'stuff': 0.25;
'stefan': 0.26; 'folks': 0.28; 'seem': 0.31; 'takes': 0.31;
'think': 0.32; 'guess': 0.32; 'python-list': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'mailing': 0.33; 'there':
0.33; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'particularly': 0.35; 'from:addr:gmail.com': 0.35; 'posts': 0.36;
'people': 0.36; 'those': 0.36; "it's": 0.37; 'text': 0.39; 'list':
0.39; 'use': 0.39; 'wrote': 0.39; 'happen': 0.40; 'follow': 0.62;
'your': 0.64; 'his': 0.65; 'dedicated': 0.65; 'tool': 0.65;
'back': 0.67; 'bad': 0.67; 'brain,': 0.84; 'dispute': 0.84;
'texts': 0.91; 'blocked': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1715017710; x=1715622510; darn=python.org;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=ywYKQ+8VTzCdiFsa/EyGiI3psbRl9QWCuVgodf3AcgU=;
b=VzaSP7zuNS+W1Fr3OhUuMZQIhfyeC1mCbAK9VHIeoG93ngs0TMTOCyc4cOrY8ulbfg
CJJ7fxRW5w9XAHP82p41p0MlnQsqSLLyXn1ljPLZ7uPY7WG1bHyBK0xIgQwv0Vm0hPxg
OEC4Fl5d/7GxhIZwZD3e3M0CROA2JjDUHLz6r/2ew5pP6c/prwIVlZK1wNEDdhCKfmR9
XONXEBG/yxe4pZyLrVLQewezm1r4OXQfOF/iV/g0B8g2LCerOIw5TgQQGarmW5FJ2DSr
EwoDRl5jRXDnOFM7AduK6WuYkB+8LApCOhJGB9C8J6Iws2snapMwmAEi73OOuiRxE+v3
T2vg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1715017710; x=1715622510;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=ywYKQ+8VTzCdiFsa/EyGiI3psbRl9QWCuVgodf3AcgU=;
b=PeyzyEmiVPnmGWdc8YZNmuWHid0jONi/0rtT/7LfhLQLtCHLLuI1UJL0Nmnbg9G9M0
sFVOq/0246qn+e0PGwTimCJoL+eJcckrmoEaszs04+8r9GuRGRD1oC9StvLDcenjyhqD
G/vyGuVt7HQfV23JBODCs03QBSlWRRUJ8OP9nwlOkwGs9wIoLseQ6EMGCR7ufNx7VHpg
qbNd7UaUS6CIIucDu7c+w2J89ZSHXcxT1vD2kcXsrn1hHpnmFXzlBUo3mKViqLTNWFy4
O9Ig+ovJXko6fVUMk/UwTLHlgeVwrlnxPizcr8qFdRgYR5lMAAg4krJLVucKSOamS6TA
tgCg==
X-Gm-Message-State: AOJu0Yx3S7eM8sQISjdlQnYfHaBhHig6u6rDW2oJn/GLUHHP6uz7yh5+
gWHtrQ+4lBoyA+PUfAwOzsqrcy05AvkSixcBddFeL1k4ylfysJKkIf+5K45CsevSrPKw++fYlzA
Ku9oGnQRJua2vUhdyIDALJl0rFUUFLA==
X-Google-Smtp-Source: AGHT+IFUiiN4XeIOeEB9KhNTfNWCIZPzucVLKz9uxKPErflKK92TWhdLTTJgD5bfzSoFSw5f4YrUZokkucMsEkDtsoo=
X-Received: by 2002:a05:651c:1a0f:b0:2d9:f7f8:3e87 with SMTP id
by15-20020a05651c1a0f00b002d9f7f83e87mr8801928ljb.32.1715017710264; Mon, 06
May 2024 10:48:30 -0700 (PDT)
In-Reply-To: <v1acge$2h0qo$1@dont-email.me>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <CAPTjJmq00N_zrP22VGJvhju8S8uvH+aQQZgD9Sx=2O9pr2VQzQ@mail.gmail.com>
X-Mailman-Original-References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de> <v1acge$2h0qo$1@dont-email.me>
 by: Chris Angelico - Mon, 6 May 2024 17:48 UTC

On Tue, 7 May 2024 at 03:42, jak via Python-list <python-list@python.org> wrote:
>
> Loris Bennett ha scritto:
> > ram@zedat.fu-berlin.de (Stefan Ram) writes:
> >
> >> Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!
> >
> > Is there a name for this kind of indentation, i.e. the stuff you are
> > writing not being flush left? It is sort of contrary to
> > what I think of as "normal" indentation. You seem to use it in all your
> > postings, too, which hurts my brain, but I guess that's my problem :-)
> >
> > [snip (40 lines)]
> >
>
> It's not just your problem. When the texts are particularly long and
> complex, I happen to use Google-Translator. It makes bad translations if
> the lines are interrupted by the newline, so I wrote a tool dedicated to
> Stefan and to all those who indent like him. This tool takes the text
> from the clipboard, removes all the superfluous spaces, combines all the
> lines in one and puts the result back into the clipboard. :-D
>

Fun fact: His posts are completely irrelevant to people who follow the
mailing list. Due to a dispute over permissions, his posts are blocked
at the gateway. So all of us folks who use the mailing list never need
to see the wonky indentation.

ChrisA

Re: Python Dialogs (Posting On Python-List Prohibited)

<v1bisr$2q1db$2@dont-email.me>

  copy mid

https://news.novabbs.com/devel/article-flat.php?id=25475&group=comp.lang.python#25475

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.python
Subject: Re: Python Dialogs (Posting On Python-List Prohibited)
Date: Mon, 6 May 2024 21:42:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <v1bisr$2q1db$2@dont-email.me>
References: <dialog-20240502150909@ram.dialup.fu-berlin.de>
<87frv02sg1.fsf@zedat.fu-berlin.de> <v1acge$2h0qo$1@dont-email.me>
<spaces-20240506123628@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 06 May 2024 23:42:52 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="dc1d33da74917bfc47081f50e6ae0383";
logging-data="2950571"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189IxBVFFI/I7INNGVDIFOQ"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:Ijx0w4KO2yVJSmQSm6h749wAWqY=
 by: Lawrence D'Oliv - Mon, 6 May 2024 21:42 UTC

On 6 May 2024 11:43:01 GMT, Stefan Ram wrote:

> Well, that won't fly in Python because indentation actually affects
> the code's meaning.

This is another reason why I use “#end” comments. Even if the indentation
gets screwed up, it is still possible to reconstruct what it means.
Otherwise, the code would just become irretrievable gibberish.


devel / comp.lang.python / Re: Python Dialogs

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor