[Python-ideas] Re: An option to force the path separator for the "os.path.join()" method.

2021-01-06 Thread Serhiy Storchaka
06.01.21 06:07, Mikhail V пише: > I know there is the "pathlib" module with all conversion methods, but > it's overkill for many > tasks. So I'd rather like to have an option to write for example: > > path = os.path.join (root, dir, sep = "posix") > > So that it joins with the forward slash e

[Python-ideas] Re: An option to force the path separator for the "os.path.join()" method.

2021-01-06 Thread Stephen J. Turnbull
Steven D'Aprano writes: > URLs are also a lot more complicated than file paths, It may be just me, but I would say the opposite: URLs are simpler because they follow unambiguous rules. There is no "realpath" for URLs, they're WYSIWYG. "." and ".." have unambiguous semantics in URLs[1], which a

[Python-ideas] Re: Python with braces formal proposal?

2021-01-06 Thread Steven D'Aprano
On Wed, Jan 06, 2021 at 10:38:30AM +0300, Paul Sokolovsky wrote: > Hello, > > On Tue, 5 Jan 2021 14:29:03 +0100 > Ronald Oussoren wrote: > > [] > > > > In this regard, braces aren't worse than average other stuff posted > > > here. Actually, it might be a bit more interesting, as it clearly > >

[Python-ideas] Re: Python with braces formal proposal?

2021-01-06 Thread Chris Angelico
On Wed, Jan 6, 2021 at 9:27 PM Steven D'Aprano wrote: > I'm glad that things like Perl one-liners, obfuscated C, and > sewerage treatment works exist... :) > Multi-statment anonymous functions are, in my opinion, overrated, and a > (slight) code smell. If your lambda is so complex it requires mo

[Python-ideas] Add a "closed for" loop (was "PEP 533 Redux?")

2021-01-06 Thread Brendan Moloney
I mentioned this off-hand in the other thread, but the more I think about it the more I think it is a reasonable compromise between the two schools of thought on PEP 533. Wouldn't the new PEG parser allow a "closed for" statement without breaking code that uses "closed" as a variable (it would

[Python-ideas] Re: Add a "closed for" loop (was "PEP 533 Redux?")

2021-01-06 Thread Paul Bryan via Python-ideas
Reading through the PEP again and some of the discussion, I think I now better understand the issue. If we were to undertake a change in for's behavior, unless the generator is actually explicitly scoped to the for statement (and doesn't survive outside of the loop, which is not how it works today