[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Chris Angelico
On Thu, Apr 2, 2020 at 3:27 PM Steven D'Aprano wrote: > Or maybe that's just an argument that no solution is going to solve > *every* problem. What do we do about people who write this: > > buf = f'{buf}{substring}' > > inside a loop? We can't fix everyone's code with one change. > I don't

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Steven D'Aprano
On Tue, Mar 31, 2020 at 12:39:56AM -0700, Christopher Barker wrote: > But while the OP specifically suggested adding += to stringIO, you might > note that he did not suggest it as an extension to the file protocol, which > StringIO mimics. Rather, he suggested that there should be something that

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Steven D'Aprano
On Wed, Apr 01, 2020 at 07:00:00PM -0700, Christopher Barker wrote: > > But with all that, I don't see why such a "mutable string" would be > > more suitable for "string builder" pattern. > > It would in one small way, which is that it would be usable directly in > many (not all by any means)

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Steven D'Aprano
On Wed, Apr 01, 2020 at 09:25:46PM -0400, Kyle Stanley wrote: > While I agree that it's sometimes okay to go outside the strict bounds of > "only one way to do it" The Zen of Python was invented as a joke, not holy writ, and as a series of koans intended to guide thought, not shut it down.

[Python-ideas] Re: [Python-Dev] reversed enumerate

2020-04-01 Thread Andrew Barnert via Python-ideas
Before jumping in: In many cases, when you want to reverse an enumerate, it’s small and fixed-sized, so there’s a trivial way to do this: Just store the enumerate iterator in a tuple, and tuples are reversible. for idx, value in reversed(tuple(enumerate(stuff))): But of course there are

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Andrew Barnert via Python-ideas
On Apr 1, 2020, at 14:47, Paul Sokolovsky wrote: > >> At the moment, the >> message is relatively clear - "build a list and join it" (it's very >> rare that anyone suggests StringIO currently). > > I don't know how much you mix with other Pythonistas, but word "clear" > is an exaggeration.

[Python-ideas] Re: [Python-Dev] reversed enumerate

2020-04-01 Thread Steven D'Aprano
Hi Ilya, I'm not sure that this mailing list (Python-Dev) is the right place for this discussion, I think that Python-Ideas (CCed) is the correct place. For the benefit of Python-Ideas, I have left your entire post below, to establish context. [Ilya] > I needed reversed(enumerate(x: list)) in

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Christopher Barker
On Wed, Apr 1, 2020 at 1:31 PM Paul Sokolovsky wrote: > > > In short: a mutable string would satisfy the requirements of a "string > > builder", and more. > > Thanks for the detailed explanation. For me, a canonical example of a > feature of "mutable string" would be: > > s = MutStr("foo") >

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Chris Angelico
On Thu, Apr 2, 2020 at 12:27 PM Kyle Stanley wrote: > As Chris Angelico mentioned, this can be observed through monitoring the > before and after RSS (or equivalent on platforms without it). On Linux, I > typically use something like this: > > ``` > def show_rss(): > os.system(f"grep ^VmRSS

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Kyle Stanley
Paul Sokolovsky wrote: > Roughly speaking, the answer would be about the same in idea as answers > to the following questions: > [snip] I would say the difference between this proposal so far and the ones listed are that they emphasized concrete, real-world examples from existing code either in

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Paul Sokolovsky
Hello, On Wed, 1 Apr 2020 10:01:06 +0100 Paul Moore wrote: > On Wed, 1 Apr 2020 at 02:07, Steven D'Aprano > wrote: > > Paul has not suggested making StringIO look and feel like a string. > > Nobody is going to add 45+ string methods to StringIO. This is a > > minimal extension to the StringIO

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Paul Sokolovsky
Hello, On Tue, 31 Mar 2020 17:01:19 -0700 Christopher Barker wrote: [] > So that suggested to me that a mutable string type would completely > satisfy your use case, but be more natural to folks used to strings: > > message = MutableString("The start of the message") > for i in something: >

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Andrew Barnert via Python-ideas
On Apr 1, 2020, at 11:59, Jonathan Goble wrote: > >> On Wed, Apr 1, 2020 at 2:35 PM Dan Sommers >> <2qdxy4rzwzuui...@potatochowder.com> wrote: >> On Wed, 01 Apr 2020 10:50:29 -0700 >> Brendan Barnwell wrote: >> >> > ... we must demand that the language itself be renamed to something >> > less

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Jonathan Goble
On Wed, Apr 1, 2020 at 2:35 PM Dan Sommers < 2qdxy4rzwzuui...@potatochowder.com> wrote: > On Wed, 01 Apr 2020 10:50:29 -0700 > Brendan Barnwell wrote: > > > ... we must demand that the language itself be renamed to something > > less offensive and more accurate, such as > >

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Dan Sommers
On Wed, 01 Apr 2020 10:50:29 -0700 Brendan Barnwell wrote: > ... we must demand that the language itself be renamed to something > less offensive and more accurate, such as > ConvenientProgrammingLanguage ... ITYM convenient_programming_language. See PEP 8, Naming Conventions, Method Names and

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Rhodri James
On 01/04/2020 19:07, MRAB wrote: On 2020-04-01 18:20, Andrew Barnert via Python-ideas wrote: On Mar 31, 2020, at 20:03, Greg Ewing wrote: On 1/04/20 7:08 am, Serhiy Storchaka wrote: 31.03.20 20:52, Antoine Pitrou пише: Your search is incomplete, for example you failed to account for

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread MRAB
On 2020-04-01 18:20, Andrew Barnert via Python-ideas wrote: On Mar 31, 2020, at 20:03, Greg Ewing wrote: On 1/04/20 7:08 am, Serhiy Storchaka wrote: 31.03.20 20:52, Antoine Pitrou пише: Your search is incomplete, for example you failed to account for occurrences of "cheese" and

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Brendan Barnwell
On 2020-03-31 10:17, Gerrit Holl wrote: (needs a sponsor) latest version at https://github.com/gerritholl/peps/blob/animal-friendly/pep-.rst PEP: Title: Retire animal-unfriendly language Author: Gerrit Holl Discussions-To: python-ideas@python.org Status: Draft Type: Informational

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Antoine Pitrou
On Wed, 1 Apr 2020 10:20:39 -0700 Andrew Barnert via Python-ideas wrote: > On Mar 31, 2020, at 20:03, Greg Ewing wrote: > > > > On 1/04/20 7:08 am, Serhiy Storchaka wrote: > >> 31.03.20 20:52, Antoine Pitrou пише: > >>> Your search is incomplete, for example you failed to account for > >>>

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Andrew Barnert via Python-ideas
On Mar 31, 2020, at 20:03, Greg Ewing wrote: > > On 1/04/20 7:08 am, Serhiy Storchaka wrote: >> 31.03.20 20:52, Antoine Pitrou пише: >>> Your search is incomplete, for example you failed to account for >>> occurrences of "cheese" and "milkshake". > > Should we deprecate the word "wheel" as

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Michael Christensen
We've got to be considerate of other languages: What if, for example, a German speaker is looking for example code in English documentation and sees the word "speck"? He/she will think it means bacon and will be offended! Sent via the Samsung Galaxy S® 6, an AT 4G LTE smartphone Get Outlook for

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Oleg Broytman
On Tue, Mar 31, 2020 at 04:11:12PM -0700, Matthias Bussonnier wrote: > On Tue, 31 Mar 2020 at 10:18, Gerrit Holl wrote: > > > the command ``cat $(find . -name '*.py') | grep -oi term | wc -l`` was used. > > I'm quite concern in the lack of mention of proper forms and procedure > to perform

[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-01 Thread Paul Moore
On Wed, 1 Apr 2020 at 02:07, Steven D'Aprano wrote: > Paul has not suggested making StringIO look and feel like a string. > Nobody is going to add 45+ string methods to StringIO. This is a minimal > extension to the StringIO class which will allow people to improve their > string building code