[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Eryk Sun
On 4/11/22, Chris Angelico wrote: > > Which raises the question: what if the current directory no longer has > a path name? Or is that simply not possible on Windows? The process working directory is opened without FILE_SHARE_DELETE sharing. This prevents opening the directory with DELETE access

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Ethan Furman
On 4/11/22 11:06, Chris Angelico wrote: Steven is, as are a few who have agreed that namespaces are the One True Way™ to do things. That seems a grossly unfair characterization of those who don't agree with you. I think everyone should take a break from this thread -- it is apparent that no o

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread MRAB
On 2022-04-11 20:01, Chris Angelico wrote: [snip] Which raises the question: what if the current directory no longer has a path name? Or is that simply not possible on Windows? I know that on Linux, I can unlink a directory while being in it (which creates interesting problems for bash, git, and

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Chris Angelico
On Tue, 12 Apr 2022 at 05:14, Christopher Barker wrote: > > On Mon, Apr 11, 2022 at 11:10 AM Chris Angelico wrote: >> >> > I don’t know about anyone else, but I’m not arguing for module scope. I’m >> > arguing against implicit global configuration. >> > >> >> Steven is, as are a few who have agr

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Christopher Barker
On Mon, Apr 11, 2022 at 11:10 AM Chris Angelico wrote: > > I don’t know about anyone else, but I’m not arguing for module scope. > I’m arguing against implicit global configuration. > > > > Steven is, as are a few who have agreed that namespaces are the One > True Way™ to do things. > I'm agreei

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Chris Angelico
On Tue, 12 Apr 2022 at 04:46, Eryk Sun wrote: > > On 4/11/22, Chris Angelico wrote: > > > > If you say `open("/spam")`, Windows uses "default drive" + "explicit > > directory". > > You can think of a default drive as being the drive of the current > working directory, but there is no "default dri

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Eryk Sun
On 4/11/22, Chris Angelico wrote: > > If you say `open("/spam")`, Windows uses "default drive" + "explicit > directory". You can think of a default drive as being the drive of the current working directory, but there is no "default drive" per se that's stored separate from the working directory.

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Chris Angelico
On Tue, 12 Apr 2022 at 02:51, Christopher Barker wrote: > > >> The context manager changes the entire process's WD for a section of >> code. This makes sense, although it has its own consequences. > > > Actually, now that you say that— I think it makes my point: the fact that > this context manag

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Chris Angelico
On Tue, 12 Apr 2022 at 03:49, Steven D'Aprano wrote: > > Windows has up to 27 working directories per process. There's the > > overall working directory directory, plus one for each drive. > > Today I learned something new, thank you. > > How does that work in practice? In Windows, if you just say

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Eryk Sun
On 4/11/22, Steven D'Aprano wrote: > > How does that work in practice? In Windows, if you just say the > equivalent to `open('spam')`, how does the OS know which drive > and WD to use? "spam" is resolved against the process working directory, which could be a UNC path instead of a drive. OTOH, "Z

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Steven D'Aprano
On Mon, Apr 11, 2022 at 11:53:18AM -0500, Eryk Sun wrote: > On 4/11/22, Steven D'Aprano wrote: > > > > You know how every OS process has its own working directory? Just like > > that, except every module. > > A per-thread working directory makes more sense to me. Hmmm, yes, that does seem sensib

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Christopher Barker
> The context manager changes the entire process's WD for a section of > code. This makes sense, although it has its own consequences. Actually, now that you say that— I think it makes my point: the fact that this context manager is necessary, and “has consequences” is because the working dir is

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Eryk Sun
On 4/11/22, Steven D'Aprano wrote: > > You know how every OS process has its own working directory? Just like > that, except every module. A per-thread working directory makes more sense to me. But it would be a lot of work to implement support for this in the os and io modules, for very little g

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-11 Thread Steven D'Aprano
On Mon, Apr 11, 2022 at 07:32:12AM -0700, Ethan Furman wrote: > My apologies for not understanding your example. The counter example I had > in my head, and should have written down, was something like: > > 15mpg * 7l == how many miles? > > where > > mpg = miles per gallons > l = litr

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-11 Thread André Roberge
On Mon, Apr 11, 2022 at 11:33 AM Ethan Furman wrote: > On 4/10/22 21:33, Stephen J. Turnbull wrote: > > > I guess you could call the associative law of multiplication "dumb > > luck", but most mathematicians will consider that hate speech. > > My apologies for not understanding your example. The

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-11 Thread Ethan Furman
On 4/10/22 21:33, Stephen J. Turnbull wrote: I guess you could call the associative law of multiplication "dumb luck", but most mathematicians will consider that hate speech. My apologies for not understanding your example. The counter example I had in my head, and should have written down,

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-11 Thread Joao S. O. Bueno
On Mon, Apr 11, 2022 at 3:39 AM Chris Angelico wrote: On Mon, 11 Apr 2022 at 15:25, Stephen J. Turnbull > wrote: > > [1] They don't have to be big problems or proprietary code; computing > > Fibonacci sequences will do, if you can find a way to make MI relevant > > to that task. > > > > > We s

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Chris Angelico
On Mon, 11 Apr 2022 at 19:30, Steven D'Aprano wrote: > > On Mon, Apr 11, 2022 at 12:21:41PM +1000, Chris Angelico wrote: > > On Mon, 11 Apr 2022 at 10:41, Steven D'Aprano wrote: > > > > > > On Sat, Apr 09, 2022 at 02:52:50AM +1000, Chris Angelico wrote: > > > > > > > We aren't bothered by the fac

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Steven D'Aprano
On Mon, Apr 11, 2022 at 12:21:41PM +1000, Chris Angelico wrote: > On Mon, 11 Apr 2022 at 10:41, Steven D'Aprano wrote: > > > > On Sat, Apr 09, 2022 at 02:52:50AM +1000, Chris Angelico wrote: > > > > > We aren't bothered by the fact that os.chdir() > > > is global, we just accept that it belongs to

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Steven D'Aprano
On Sun, Apr 10, 2022 at 10:16:04PM -0700, Christopher Barker wrote: > I have seen code that caches the workingdir, change it, then puts it back > -- but that's very much not thread > safe, and I'd only recommend it maybe in tests. If you google for it, there are about a million recipes and blog p

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-11 Thread Steven D'Aprano
On Sun, Apr 10, 2022 at 11:50:40AM -0700, Brendan Barnwell wrote: > You seem to be envisioning a system in which multiple inheritance > gives a subclass a "menu" of behaviors from which it may explicitly > choose, > but does not actually combine the superclasses' behaviors into a si

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Ronald Oussoren via Python-ideas
> On 10 Apr 2022, at 11:20, Chris Angelico wrote: > > On Sun, 10 Apr 2022 at 18:44, Ronald Oussoren via Python-ideas > mailto:python-ideas@python.org>> wrote: >> >> >> >> On 8 Apr 2022, at 16:33, Steven D'Aprano wrote: >> >> On Tue, Apr 05, 2022 at 02:17:00PM +1000, Chris Angelico wrote: >