[Python-ideas] Re: Adding str.remove()

2021-05-01 Thread Stephen J. Turnbull
David Mertz writes: > Lots of things "should be" :-). Sadly, I deal with "actually existing data." What I would do to experience your kind of sadness! I spend most of my time working around (or doing theory instead of working on) "actually nonexisting data". ;-) Steve

[Python-ideas] Re: TACE16 text encoding for Tamil language

2021-05-01 Thread Stephen J. Turnbull
Jonathan Goble writes: > I assume the "cpython" part of these paths here is your local clone of the > CPython GitHub repo? (Otherwise these local filepaths from your computer > don't make sense.) Thanks for catching that! Sorry, I was concentrating on stifling irrelevant Unicode politics.

[Python-ideas] Comprehensions within f-strings

2021-05-01 Thread Valentin Berlier
Recently there's been some discussion around string comprehensions, and I wanted to look at a specific variant of the proposal in a bit more detail. Original thread: https://mail.python.org/archives/list/python-ideas@python.org/thread/MVQGP4GGTIWQRJTSY5S6SDYES6JVOOGK/ Let's say i have a matrix

[Python-ideas] Re: String comprehension

2021-05-01 Thread Valentin Berlier
> But that was not the primary motivator for adding them to the language. I don't think the original author thinks that way either about string comprehensions. I was asked about the kind of speed benefits that string comprehensions would have over using a generator with "".join() and I used

[Python-ideas] Re: Improving sys.executable for embedded Python scenarios

2021-05-01 Thread Gregory P. Smith
On Sat, May 1, 2021 at 10:49 AM Gregory Szorc wrote: > The way it works today, if you have an application embedding Python, your > sys.argv[0] is (likely) your main executable and sys.executable is probably > None or the empty string (per the stdlib docs which say not to set > sys.executable if

[Python-ideas] Re: Namespaces!

2021-05-01 Thread David Mertz
So this is exactly the same as `types.SimpleNamespace`, but with special syntax?! On Sat, May 1, 2021, 7:57 PM Matt del Valle wrote: > Hi all! > > So this is a proposal for a new soft language keyword: > > namespace > > I started writing this up a few hours ago and then realized as it was >

[Python-ideas] Namespaces!

2021-05-01 Thread Matt del Valle
Hi all! So this is a proposal for a new soft language keyword: namespace I started writing this up a few hours ago and then realized as it was starting to get away from me that there was no way this was going to be even remotely readable in email format, so I created a repo for it instead and

[Python-ideas] Re: String comprehension

2021-05-01 Thread Joao S. O. Bueno
I started seeing this, as the objecting people are putting, something that is really outside of the scope. But it just did occur to me that having to use str.join _inside_ an f-string expression is somewhat cumbersome I mean, think of a typical repr for a sequence class: return f"MyClass({',

[Python-ideas] Re: String comprehension

2021-05-01 Thread Christopher Barker
On Fri, Apr 30, 2021 at 11:15 PM Valentin Berlier wrote: > > You could say that f-strings are redundant because they can't do > anything that str.format can't, but they make it possible to shave off the > static overhead of going through python's protocols and enable additional > optimizations.

[Python-ideas] Improving sys.executable for embedded Python scenarios

2021-05-01 Thread Gregory Szorc
The way it works today, if you have an application embedding Python, your sys.argv[0] is (likely) your main executable and sys.executable is probably None or the empty string (per the stdlib docs which say not to set sys.executable if there isn't a path to a known `python` executable).

[Python-ideas] Re: TACE16 text encoding for Tamil language

2021-05-01 Thread Jonathan Goble
On Sat, May 1, 2021 at 11:17 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Start here: > /Users/steve/src/Python/cpython/Doc/library/codecs.rst > /Users/steve/src/Python/cpython/Doc/c-api/codec.rst > > To write them in C, follow the code in > Likely needed (forgot where

[Python-ideas] TACE16 text encoding for Tamil language

2021-05-01 Thread Stephen J. Turnbull
You wrote: > I want to use this encoding > > for Tamil language text As written, it sounds like you just want help. If so, this list is for proposals to change Python itself (including the standard library), and

[Python-ideas] Re: Adding str.remove()

2021-05-01 Thread David Mertz
On Sat, May 1, 2021, 3:17 AM Cameron Simpson wrote: > >Let's take a not-absurd hypothetical: > > > >GET [http://example.com/picture] 200 image/jpeg > >POST [http://nowhere.org/data] 200 application/json > >PUT [https://example.org/page] 200 text/html > > Though for this, they are ok. Or even

[Python-ideas] Re: Changing The Theme of Python Docs Site

2021-05-01 Thread Stephen J. Turnbull
Abdur-Rahmaan Janhangeer writes: > I have been reading the Python docs since long. > I have enjoyed it, it has great pieces of information. > You have how-tos, faqs etc. Really awesome to read. Thank you! ;-) > However, I feel that the style is a bit bland and off putting > for newcomers.

[Python-ideas] Re: String comprehension

2021-05-01 Thread Brendan Barnwell
On 2021-04-30 11:14, David Álvarez Lombardi wrote: To me, it is hard to see how any argument against this design (for anything other than implementation-difficulty or something along these lines) can be anything but an argument against iter comprehensions in general... but if someone disagrees,

[Python-ideas] Re: String comprehension

2021-05-01 Thread Stestagg
On Fri, 30 Apr 2021 at 17:08, David Álvarez Lombardi wrote: > I propose a syntax for constructing/filtering strings analogous to the one > available for all other builtin iterables. It could look something like > this. > > >>> dirty = "f8sjGe7" > >>> clean = c"char for char in dirty if char in

[Python-ideas] Re: String comprehension

2021-05-01 Thread Valentin Berlier
> you talked about builtin *iterables* My mistake, I reused the terminology used by the original author to make it easier to follow. > The point of iterators like map, zip and filter is to *avoid* performing the > computation until it is required. Of course. Maybe I wasn't clear enough. I

[Python-ideas] Re: String comprehension

2021-05-01 Thread Steven D'Aprano
On Sat, May 01, 2021 at 06:21:43AM -, Valentin Berlier wrote: > > The builtin interables bytearray, bytes, enumerate, filter > > frozenset, map, memoryview, range, reversed, tuple and zip suggest > > differently. > > enumerate, filter, map, range, reversed and zip don't apply because >

[Python-ideas] Re: Adding str.remove()

2021-05-01 Thread Cameron Simpson
On 01May2021 05:30, David Mertz wrote: >I was actually thinking about this before the recent "string comprehension" >thread. I wasn't really going to post the idea, but it's similar enough >that I am nudged to. Moreover, since PEP 616 added str.removeprefix() and >str.removesuffix(), this feels

[Python-ideas] Re: String comprehension

2021-05-01 Thread Valentin Berlier
> The builtin interables bytearray, bytes, enumerate, filter frozenset, map, > memoryview, range, reversed, tuple and zip suggest differently. enumerate, filter, map, range, reversed and zip don't apply because they're not collections, you wouldn't be able to store the result of the computation

[Python-ideas] Re: String comprehension

2021-05-01 Thread Valentin Berlier
> c"f(c) for c in some_string if g(c)" Even this example would allow the interpreter to skip building the generator object and having to feed the result of every f(c) back into the iterator protocol. This is similar to f-strings vs str.format. You could say that f-strings are redundant because