[Python-ideas] The Mailing List Digest Project

2019-03-25 Thread Abdur-Rahmaan Janhangeer
As proposed on python-ideas, i setup a repo to turn mail threads into articles. here is the repo https://github.com/Abdur-rahmaanJ/py-mailing-list-summary i included a script to build .md to .html (with syntax highlighting) here is the index

Re: [Python-ideas] A directive for indentation type, stricter indentation parsing.

2019-03-25 Thread fhsxfhsx
Just as to your example, you can try `textwrap.dedent` At 2019-03-26 00:32:26, "Mikhail V" wrote: >Not a proposal yet, but some thoughts: >I think it would help in a longer perspective if a user could >include a directive in the header of the source code file that >defines indentation

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Greg Ewing
Dan Sommers wrote: So what it is "hello" - "world"? If we were to implement the entire group, it would be an element that can't be written in any simpler form. We could do that by representing a string as a sequence of signed substrings, and performing cancellations whereever possible during

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Paul Moore
On Mon, 25 Mar 2019 at 17:49, Anders Hovmöller wrote: > > > All of this would be well served by a 3rd party library on PyPI. Strings > > already have plenty of methods (probably too many). Having `stringtools` > > would be nice to import a bunch of simple functions from. > > I respectfully

Re: [Python-ideas] A directive for indentation type, stricter indentation parsing.

2019-03-25 Thread Brett Cannon
On Mon, Mar 25, 2019 at 9:33 AM Mikhail V wrote: > Not a proposal yet, but some thoughts: > I think it would help in a longer perspective if a user could > include a directive in the header of the source code file that > defines indentation character(s) for this source file. So this > source

Re: [Python-ideas] META: Is a PEP a good place to record Python's core design decisions and coding principles?

2019-03-25 Thread Brett Cannon
On Sun, Mar 24, 2019 at 10:34 AM Jonathan Fine wrote: > Guido van Rossum wrote: > >> I think this belongs in a personal blog, not on python-ideas and >> definitely not in a PEP. >> > > I don't agree, but I will accept that judgement, as if Guido still had > BDFL status. > To help add more

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Anders Hovmöller
> All of this would be well served by a 3rd party library on PyPI. Strings > already have plenty of methods (probably too many). Having `stringtools` > would be nice to import a bunch of simple functions from. I respectfully disagree. This isn't javascript where we are OK with millions of

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Terry Reedy
On 3/25/2019 10:55 AM, David Mertz wrote: All of this would be well served by a 3rd party library on PyPI. Strings already have plenty of methods (probably too many).  Having `stringtools` would be nice to import a bunch of simple functions from. I agree. -- Terry Jan Reedy

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Terry Reedy
On 3/25/2019 6:22 AM, Jonathan Fine wrote: Instead of naming these operations, we could use '+' and '-', with semantics:     # Set the values of the variables.     >>> a = 'hello '     >>> b = 'world'     >>> c = 'hello world'     # Some values between the variables.     >>> a + b == c

[Python-ideas] A directive for indentation type, stricter indentation parsing.

2019-03-25 Thread Mikhail V
Not a proposal yet, but some thoughts: I think it would help in a longer perspective if a user could include a directive in the header of the source code file that defines indentation character(s) for this source file. So this source would be parsed strictly by this char (or sequence). E.g.:

[Python-ideas] I'm saying goodbye for a bit

2019-03-25 Thread Jonathan Fine
Hi I've been active recently in some threads, that have become a bit heated. To help things cool down, I won't be posting for a while. I don't know how long, but certainly not until Wednesday 3 April. You can of course contact me off-list if you want. -- Jonathan

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread David Mertz
All of this would be well served by a 3rd party library on PyPI. Strings already have plenty of methods (probably too many). Having `stringtools` would be nice to import a bunch of simple functions from. On Mon, Mar 25, 2019 at 10:45 AM Alex Grigoryev wrote: > strip_prefix and strip_suffix I

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Alex Grigoryev
strip_prefix and strip_suffix I think are the best names from all and work perfectly with auto completion. Common use case: " mailto:ma...@gmail.com".strip().strip_prefix("mailto:;) On Mar 25 2019, at 4:40 pm, Anders Hovmöller wrote: > > > Earlier, Anders wrote: > > I propose naming them

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Guido van Rossum
On Mon, Mar 25, 2019 at 7:30 AM Rhodri James wrote: > On 25/03/2019 12:01, Jonathan Fine wrote: > > Chris Angelico asked: what does a negative string look like? > > > > This is a very good question. It looks a bit like a negative number. > > They really don't. Negative numbers are well defined

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Jonathan Fine
Rhodri James wrote: > They really don't. Negative numbers are well defined in terms of being > the additive inverse of natural numbers. String concatenation doesn't > have a well-defined inverse, > In an earlier post I showed (assuming some knowledge of group theory) that for strings in the

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Anders Hovmöller
> Earlier, Anders wrote: > I propose naming them strip_prefix() and strip_suffix() and just skip the one > that does both sides since it makes no sense to me. > > This is good, except I prefer subtract_prefix(a, b), truncate_suffix etc. And > for the two step process prefix_subtractor(a)(b)

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Jonathan Fine
Earlier, Anders wrote: I propose naming them strip_prefix() and strip_suffix() and just skip the one that does both sides since it makes no sense to me. This is good, except I prefer subtract_prefix(a, b), truncate_suffix etc. And for the two step process prefix_subtractor(a)(b) etc. --

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Rhodri James
On 25/03/2019 12:01, Jonathan Fine wrote: Chris Angelico asked: what does a negative string look like? This is a very good question. It looks a bit like a negative number. They really don't. Negative numbers are well defined in terms of being the additive inverse of natural numbers. String

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Jonathan Fine
Here, concisely, is my view of the situation and my preferences. Mostly, I won't give supporting arguments or evidence. We can TRUNCATE either PRE or the POST, and similarly SUBTRACT. SUBTRACT can raise a ValueError. TRUNCATE always returns a value. Interactive examples (not tested) >>>

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Anders Hovmöller
I think this is a terrible idea. I also think it's a mistake that python uses + for string concatenation and * for string repeat. You end up with type errors far from the first place you could have had the crash! That ship has obviously sailed buy we shouldn't make even more mistakes in the

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Dan Sommers
On 3/25/19 7:01 AM, Jonathan Fine wrote: Chris Angelico asked: what does a negative string look like? This is a very good question. It looks a bit like a negative number. >>> 2 + 2 4 >>> len('aa' + 'bb') 4 >>> len(-'bb') -2 # Odd, I must confess. >>> 5 +

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Jonathan Fine
More on negative strings. They are easier, if they only use one character. Red Queen: What's one and one and one and one and one and one and one and one and one and one and one and one and one? Alice: I don't know. I lost count. Red Queen: She can't do arithmetic. 3 --> 'aaa' 2 --> 'aa' 1 -->

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Jonathan Fine
Chris Angelico asked: what does a negative string look like? This is a very good question. It looks a bit like a negative number. >>> 2 + 2 4 >>> len('aa' + 'bb') 4 >>> len(-'bb') -2 # Odd, I must confess. >>> 5 + (-1) 4 >>> len('hello') 5 >>>

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Chris Angelico
On Mon, Mar 25, 2019 at 9:24 PM Jonathan Fine wrote: > > Instead of naming these operations, we could use '+' and '-', with semantics: > > # Set the values of the variables. > >>> a = 'hello ' > >>> b = 'world' > >>> c = 'hello world' > > # Some values between the variables. >

Re: [Python-ideas] New explicit methods to trim strings

2019-03-25 Thread Jonathan Fine
Instead of naming these operations, we could use '+' and '-', with semantics: # Set the values of the variables. >>> a = 'hello ' >>> b = 'world' >>> c = 'hello world' # Some values between the variables. >>> a + b == c True >>> a == c - b True >>> b = -a