[Python-ideas] Re: writelines2?

2021-07-13 Thread Steven D'Aprano
On Tue, Jul 13, 2021 at 09:54:27AM -0400, Eric V. Smith wrote: > I'm skeptical that people who won't read the documentation for > writelines will either read the documentation for writelines2, or > intuitively understand how it's different from writelines, or would know > there's a kwarg

[Python-ideas] Re: writelines2?

2021-07-13 Thread Chris Angelico
On Wed, Jul 14, 2021 at 11:22 AM Steven D'Aprano wrote: > > On Tue, Jul 13, 2021 at 10:27:55PM +0300, Serhiy Storchaka wrote: > > > The writelines method is the part of interface. Adding new parameter or > > new method to interface is a major breaking change. It will make invalid > > all existing

[Python-ideas] Re: writelines2?

2021-07-13 Thread Steven D'Aprano
On Tue, Jul 13, 2021 at 08:59:21AM -0700, Guido van Rossum wrote: > Let's leave poor writelines alone. It's an old API, if you want something > different, there are a zillion other ways (e.g. print(*x, sep="\n") ). > > I wonder how much research the OP did before they claimed "writelines is a >

[Python-ideas] Re: writelines2?

2021-07-13 Thread Steven D'Aprano
On Tue, Jul 13, 2021 at 10:27:55PM +0300, Serhiy Storchaka wrote: > The writelines method is the part of interface. Adding new parameter or > new method to interface is a major breaking change. It will make invalid > all existing user code which implements this interface. I think that statement

[Python-ideas] Re: writelines2?

2021-07-13 Thread Steven D'Aprano
On Tue, Jul 13, 2021 at 09:05:54AM -0700, Christopher Barker wrote: > indeed. so if this idea is to be done (and there's something to be said for > it), I think a similar option should be added to readlines as well -- > striping the newline. I don't think that's as useful as you may expect. When

[Python-ideas] Re: builtins for running context managers

2021-07-13 Thread Thomas Grainger
Like the nodeback interface, it's (err, val) On Tue, 13 Jul 2021, 21:31 Ethan Furman, wrote: > On 7/13/21 12:43 PM, Thomas Grainger wrote: > > > I used the order I did because it's idiomatic to return the value the > user needs > > followed by the value the user wants. > > citation? > > -- >

[Python-ideas] Re: builtins for running context managers

2021-07-13 Thread Ethan Furman
On 7/13/21 12:43 PM, Thomas Grainger wrote: > I used the order I did because it's idiomatic to return the value the user needs > followed by the value the user wants. citation? -- ~Ethan~ ___ Python-ideas mailing list -- python-ideas@python.org To

[Python-ideas] Re: builtins for running context managers

2021-07-13 Thread Thomas Grainger
also https://www.python.org/dev/peps/pep-0343/ probably needs updating - but I'm not sure exactly what the code is ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: builtins for running context managers

2021-07-13 Thread Thomas Grainger
I used the order I did because it's idiomatic to return the value the user needs followed by the value the user wants. On Tue, 13 Jul 2021, 20:24 Serhiy Storchaka, wrote: > 13.07.21 18:59, Thomas Grainger пише: > > given that it's hard to implement this correctly I think there should be > a

[Python-ideas] Re: writelines2?

2021-07-13 Thread Serhiy Storchaka
13.07.21 14:15, sandhoners...@gmail.com пише: > My suggestion is to have either a writelines2 or a newline kwarg which does > put new lines automatically at the end of every line written The writelines method is the part of interface. Adding new parameter or new method to interface is a major

[Python-ideas] Re: builtins for running context managers

2021-07-13 Thread Serhiy Storchaka
13.07.21 18:59, Thomas Grainger пише: > given that it's hard to implement this correctly I think there should be a > builtins.enter and builtins.aenter for use like this: > > > ``` > @dataclasses.dataclass > class WrapCmgr: > _cmgr: ContextManager[T] > > def __enter__(self) ->

[Python-ideas] Deprecation APIs and language tooling

2021-07-13 Thread Stephen J. Turnbull
Sergei Lebedev writes: > The proliferation of deprecation APIs itself is not a problem, but it does > make it difficult (if not impossible) for language tooling to consume that > deprecation information and help users of these libraries write better > code. We don't know that it's not a

[Python-ideas] Re: Python Documentation in Bengali (translation)

2021-07-13 Thread Julien Palard via Python-ideas
Hi, Le 7/11/21 à 6:19 PM, sharifmehed...@outlook.com a écrit : > I am preparing a team to start translating python documentation to Bengali. > > I'd appreciate some reference materials, comments and ideas about this. Looks like [1] Kushal Das is the current contact for Bengali translation.

[Python-ideas] Re: writelines2?

2021-07-13 Thread David Mertz
I've written something like this far too many times: lines = (line.rstrip('\n') for line in open(frame).readlines()) It's not unworkable, but it's definitely common to want the lines without the newlines. The corresponding .writelines() hits me less, but it's still a concern. I slightly shorter

[Python-ideas] Re: writelines2?

2021-07-13 Thread Eric V. Smith
Ignore me on this, I wasn't focusing on the function at hand. Eric On 7/13/2021 10:18 AM, Eric V. Smith wrote: On 7/13/2021 9:52 AM, Thomas Güttler wrote: Am Di., 13. Juli 2021 um 15:02 Uhr schrieb >: Right now, writelines is a very big misnomer to many

[Python-ideas] Re: writelines2?

2021-07-13 Thread Guido van Rossum
Let's leave poor writelines alone. It's an old API, if you want something different, there are a zillion other ways (e.g. print(*x, sep="\n") ). I wonder how much research the OP did before they claimed "writelines is a very big misnomer to many python developers". On Tue, Jul 13, 2021 at 8:46

[Python-ideas] Re: writelines2?

2021-07-13 Thread 2QdxY4RzWzUUiLuE
On 2021-07-13 at 14:11:15 -, sandhoners...@gmail.com wrote: > Maybe (to be consistent with other functions like print), end= since > that would allow even custom line endings As it stands, writelines is consistent with readlines. Both preserve newlines. All else being equal, the following

[Python-ideas] builtins for running context managers

2021-07-13 Thread Thomas Grainger
currently lots of code manages contexts incorrectly by doing: ``` @dataclasses.dataclass class WrapCmgr: _cmgr: ContextManager[T] def __enter__(self) -> Wrapped[T]: return wrap(_cmgr.__enter__()) def __exit__(self, \, t: Type[BaseException] | None, v: BaseException, tb:

[Python-ideas] Re: writelines2?

2021-07-13 Thread MRAB
On 2021-07-13 15:18, Eric V. Smith wrote: On 7/13/2021 9:52 AM, Thomas Güttler wrote: Am Di., 13. Juli 2021 um 15:02 Uhr schrieb >: Right now, writelines is a very big misnomer to many python developers, especially beginners who would expect

[Python-ideas] Re: writelines2?

2021-07-13 Thread MRAB
On 2021-07-13 15:11, sandhoners...@gmail.com wrote: Maybe (to be consistent with other functions like print), end= since that would allow even custom line endings I'm not sure about the name 'end'. The 'print' function has 'end', but it's printed only at the end(!); .writelines would write it

[Python-ideas] Re: writelines2?

2021-07-13 Thread Paul Moore
On Tue, 13 Jul 2021 at 15:56, Jonathan Fine wrote: > > The interactive help message for writelines gives no help. I've made an > enhancement request to b.p.o. > > help(open('/dev/zero').writelines) gives no help > https://bugs.python.org/issue44623 > > Please take a look. Works for me on Python

[Python-ideas] Re: writelines2?

2021-07-13 Thread Jonathan Fine
The interactive help message for writelines gives no help. I've made an enhancement request to b.p.o. help(open('/dev/zero').writelines) gives no help https://bugs.python.org/issue44623 Please take a look. -- Jonathan ___ Python-ideas mailing list --

[Python-ideas] Re: writelines2?

2021-07-13 Thread sandhoners123
It would produce a\nb\nc\n. Essentially it would put \n after every value gotten from a iterator ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: writelines2?

2021-07-13 Thread Eric V. Smith
On 7/13/2021 7:15 AM, sandhoners...@gmail.com wrote: Right now, writelines is a very big misnomer to many python developers, especially beginners who would expect writelines to put new lines at the end of every element in the list My suggestion is to have either a writelines2 or a newline

[Python-ideas] Re: writelines2?

2021-07-13 Thread Eric V. Smith
On 7/13/2021 9:52 AM, Thomas Güttler wrote: Am Di., 13. Juli 2021 um 15:02 Uhr schrieb >: Right now, writelines is a very big misnomer to many python developers, especially beginners who would expect writelines to put new lines at the end of every

[Python-ideas] Re: writelines2?

2021-07-13 Thread sandhoners123
Maybe (to be consistent with other functions like print), end= since that would allow even custom line endings ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: writelines2?

2021-07-13 Thread Thomas Güttler
Am Di., 13. Juli 2021 um 15:02 Uhr schrieb : > Right now, writelines is a very big misnomer to many python developers, > especially beginners who would expect writelines to put new lines at the > end of every element in the list > > My suggestion is to have either a writelines2 or a newline kwarg

[Python-ideas] writelines2?

2021-07-13 Thread sandhoners123
Right now, writelines is a very big misnomer to many python developers, especially beginners who would expect writelines to put new lines at the end of every element in the list My suggestion is to have either a writelines2 or a newline kwarg which does put new lines automatically at the end