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

2019-03-24 Thread Dan Sommers
On 3/24/19 6:45 PM, Cameron Simpson wrote: Like others I'm against the name 'trim" itself because of PHP's homonym which means what "strip" means in Python (and therefore doesn't mean what "trim" is proposed to mean here). "clip"? I'm +0.9 rather than +1 entirely because the operation feels

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

2019-03-24 Thread Jeff Allen
On 24/03/2019 17:44, Christopher Barker wrote: Jonathan, This is the glory of open source projects -- if you have a great idea, you can simply do it: - Start a document that describes Python's Core design principles - Put it up somewhere (gitHub would be good) where others can contribute to

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

2019-03-24 Thread Cameron Simpson
On 24Mar2019 18:39, MRAB wrote: On 2019-03-24 08:42, Alex Grigoryev wrote: Following the discussion here This

Re: [Python-ideas] Improve os.times() resolution

2019-03-24 Thread Giampaolo Rodola'
On Sun, Mar 24, 2019 at 2:29 PM Anders Hovmöller wrote: > > Have you checked how much overhead the two functions have? That seems like an > obvious way this proposal could go south. Without patch: $ ./python -m timeit -s "import os" "os.times()" 50 loops, best of 5: 546 nsec per

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Abdur-Rahmaan Janhangeer
skeleton here: https://github.com/Abdur-rahmaanJ/py-mailing-list-summary On Sun, Mar 24, 2019 at 9:50 PM Christopher Barker wrote: > > I encourage you to look in the archives of this list for the previous > discussion -- there are some good starting points there. > > Also -- rather than a

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

2019-03-24 Thread MRAB
On 2019-03-24 08:42, Alex Grigoryev wrote: Following the discussion here I propose to add 3 new string methods:

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Abdur-Rahmaan Janhangeer
in markdown i guess, @vstinner and @matrixise initiative to rewrite a tuto for cpython beginners is really awesome according to me, yes, that's the right idea! Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius On Sun, 24 Mar 2019, 21:50

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Christopher Barker
On Sun, Mar 24, 2019 at 10:40 AM Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> wrote: > I'm up for writing it, > I encourage you to look in the archives of this list for the previous discussion -- there are some good starting points there. Also -- rather than a series of posts, a

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

2019-03-24 Thread Christopher Barker
Jonathan, This is the glory of open source projects -- if you have a great idea, you can simply do it: - Start a document that describes Python's Core design principles - Put it up somewhere (gitHub would be good) where others can contribute to it - If it becomes a wonderful thing, then propose

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Abdur-Rahmaan Janhangeer
I'm up for writing it, in fact i'm planning on a series of posts/mini books for the threads, too many, i repeat again too many gems are hidden away in the arc-hive. Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius On Sun, 24 Mar 2019, 13:12

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

2019-03-24 Thread Christopher Barker
On Sun, Mar 24, 2019 at 2:47 AM Alex Grigoryev wrote: > Yeah good idea with names because php ltrim does the same as lstrip in > python. > Normally I'd expect strip to behave as I proposed, not like input a string > as mask of characters, which is more rare use case and confusing in some >

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

2019-03-24 Thread Jonathan Fine
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. -- Jonathan ___ Python-ideas mailing list

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Christopher Barker
I think is was a couple years ago that someone on this list suggested a “commonly suggested and rejected ideas” PEP. I don’t know that it should be a PEP, but it would be a good idea to have such a document in an “official” place. We could start with this one. Interestingly (to me), Chris’s

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

2019-03-24 Thread Chris Angelico
On Mon, Mar 25, 2019 at 4:16 AM Jonathan Fine wrote: > FACTS, AXIOMS and THEOREM > > Chris Angelico wrote: >> >> It's way WAY simpler than all this. "Iterable" isn't a type, it's a >> protocol; in fact, "iterable" just means "has an __iter__ method". > > > I think that for Chris this is a FACT

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

2019-03-24 Thread Guido van Rossum
I think this belongs in a personal blog, not on python-ideas and definitely not in a PEP. On Sun, Mar 24, 2019 at 10:18 AM Jonathan Fine wrote: > SUMMARY > I think we're about to have a discussion of what's appropriate to have on > this list, so I've started a new thread. > > I formulate the

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

2019-03-24 Thread Jonathan Fine
SUMMARY I think we're about to have a discussion of what's appropriate to have on this list, so I've started a new thread. I formulate the question as: Is this list an appropriate place for the discovery, discussion and application of Python's core design decisions and coding principles? Or in

Re: [Python-ideas] Improve os.times() resolution

2019-03-24 Thread Gregory P. Smith
On Sun, Mar 24, 2019 at 5:16 AM Giampaolo Rodola' wrote: > It turns out we could use resource.getrusage() which provides micro > seconds (tested on Linux and macOS): > > import os, resource > for x in range(1000): # warm up > pass > for x in range(5): > a =

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Chris Angelico
On Mon, Mar 25, 2019 at 12:28 AM Jonathan Fine wrote: > > Disclaimer: I've not recently read any discussions of this topic. And > everything I say is my own opinion. > > SUMMARY > The syntax of Python's string join operator are a consequence of Python's > core design decisions and coding

Re: [Python-ideas] Add subprocess.Popen suspend() and resume()

2019-03-24 Thread eryk sun
On 3/24/19, Giampaolo Rodola' wrote: > On Wed, Mar 20, 2019 at 11:19 PM eryk sun wrote: > >> This code repeatedly calls PsGetNextProcessThread to walk the >> non-terminated threads of the process in creation order (based on a >> linked list in the process object) and suspends each thread via >>

Re: [Python-ideas] Improve os.times() resolution

2019-03-24 Thread Anders Hovmöller
Have you checked how much overhead the two functions have? That seems like an obvious way this proposal could go south. > On 24 Mar 2019, at 13:15, Giampaolo Rodola' wrote: > > It turns out we could use resource.getrusage() which provides micro > seconds (tested on Linux and macOS): > >

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Jonathan Fine
Disclaimer: I've not recently read any discussions of this topic. And everything I say is my own opinion. SUMMARY The syntax of Python's string join operator are a consequence of Python's core design decisions and coding principles, together with the semantics of join. I'll explain this in a

[Python-ideas] Improve os.times() resolution

2019-03-24 Thread Giampaolo Rodola'
It turns out we could use resource.getrusage() which provides micro seconds (tested on Linux and macOS): import os, resource for x in range(1000): # warm up pass for x in range(5): a = os.times() b = resource.getrusage(resource.RUSAGE_SELF)

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Juancarlo Añez
On Sun, Mar 24, 2019 at 5:11 AM Jonathan Fine wrote: > I'm willing to provide some useful information, if you're willing to write > it up into a good blog post. > ... or a PEP for rejection. Deal! -- Juancarlo *Añez* ___ Python-ideas mailing list

Re: [Python-ideas] Add subprocess.Popen suspend() and resume()

2019-03-24 Thread Giampaolo Rodola'
On Wed, Mar 20, 2019 at 11:19 PM eryk sun wrote: > > On 3/18/19, Giampaolo Rodola' wrote: > > > > I've been having these 2 implemented in psutil for a long time. On > > POSIX these are convenience functions using os.kill() + SIGSTOP / > > SIGCONT (the same as CTRL+Z / "fg"). On Windows they use

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

2019-03-24 Thread Alex Grigoryev
Yeah good idea with names because php ltrim does the same as lstrip in python. Normally I'd expect strip to behave as I proposed, not like input a string as mask of characters, which is more rare use case and confusing in some scenarios. On мар т 24 2019, at 11:34 утра, Anders Hovmöller wrote: >

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

2019-03-24 Thread Anders Hovmöller
I don't see what trim() is good for but I know I've written ltrim() hundreds of times easy. 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. Trim is generally a bad name because what is called strip() in python

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Jonathan Fine
I'm willing to provide some useful information, if you're willing to write it up into a good blog post. -- Jonathan ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:

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

2019-03-24 Thread Chris Angelico
On Sun, Mar 24, 2019 at 7:43 PM Alex Grigoryev wrote: > > Following the discussion here I propose to add 3 new string methods: > str.trim, str.ltrim, str.rtrim > Another option would be to change API for str.split method to work correctly > with sequences. > > In [1]: def ltrim(s, seq): >

[Python-ideas] New explicit methods to trim strings

2019-03-24 Thread Alex Grigoryev
Following the discussion here (https://link.getmailspring.com/link/7d84d131-65b6-4ef7-9c43-51957f9df...@getmailspring.com/0?redirect=https%3A%2F%2Fbugs.python.org%2Fissue36410=cHl0aG9uLWlkZWFzQHB5dGhvbi5vcmc%3D) I propose to add 3 new string methods: str.trim, str.ltrim, str.rtrim Another option

Re: [Python-ideas] Add subprocess.Popen suspend() and resume()

2019-03-24 Thread Gregory P. Smith
I don't think this belongs in subprocess. It isn't related to processes creation. A module on PyPI with the Windows code would make more sense. On Wed, Mar 20, 2019 at 3:19 PM eryk sun wrote: > On 3/18/19, Giampaolo Rodola' wrote: > > > > I've been having these 2 implemented in psutil for a

Re: [Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

2019-03-24 Thread Serhiy Storchaka
23.03.19 18:24, Christopher Barker пише: I wonder how often + is used with lists in the stdlib... Searching for "+ [" shows that even concatenating with the string display and comprehensions is several times more common that merging dicts. And there should be cases not covered by this simple