[Python-ideas] Re: Adding PathLiteral class and existing object instance to pathlib

2021-02-15 Thread mwmajewsk
You are right, it would not, I incorrectly assumed that since Path() actually evaluates to PosixPath('.') then Path()/'tmp' evaluates to PosixPath('./tmp') but it does not. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an

[Python-ideas] Re: Adding PathLiteral class and existing object instance to pathlib

2021-02-15 Thread Christopher Barker
On Mon, Feb 15, 2021 at 5:21 PM Paul Bryan wrote: > I wonder how that is substantially different than: > > or perhaps more verbosely, but arguably more readable: > > from pathlib import Path > > Path() / "foo" > > or from pathlib import Path Path("foo") I guess I don't find the proposal or va

[Python-ideas] Re: Conditional with statements

2021-02-15 Thread Christopher Barker
Still OT ... > But I do think you need to consider not just your editor -- if anyone else > is going to read your code. > > They're not (in any universe I can imagine). > Exactly -- the most important thing about style is that it be consistent within a project's development team -- if that's just

[Python-ideas] Re: Adding PathLiteral class and existing object instance to pathlib

2021-02-15 Thread Paul Bryan
I wonder how that is substantially different than: from pathlib import Path as p p() / "foo" or perhaps more verbosely, but arguably more readable: from pathlib import Path Path() / "foo" Paul On Tue, 2021-02-16 at 01:07 +, mwmajewsk wrote: > P.S. the code snippet I mentioned is not rende

[Python-ideas] Re: Adding PathLiteral class and existing object instance to pathlib

2021-02-15 Thread mwmajewsk
P.S. the code snippet I mentioned is not rendering with mailman archives, here it is again; from pathlib import path_literal as p p/"foo" the result is: PosixPath('foo') ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an em

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Rob Cliffe via Python-ideas
On 15/02/2021 16:32, David Mertz wrote: On Mon, Feb 15, 2021 at 4:19 PM Guido van Rossum > wrote: Okay, here’s my dilemma. It looks like this thread wants to devise a new syntax for lambda, using e.g. (x, y) -> x+y, or the same with =>. That’s great, but do

[Python-ideas] Adding PathLiteral class and existing object instance to pathlib

2021-02-15 Thread mwmajewsk
Hi All, The pathlib library is really helpful when working with paths, but creating an instance of Path class could be easier. There was a discussion about solving this with p-strings here https://mail.python.org/archives/list/python-ideas@python.org/thread/MNKRQF3ZM77A224EO5OZLLAUFGB5MTVA/#OH4

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Greg Ewing
On 16/02/21 6:29 am, Guido van Rossum wrote: I can sympathize with trying to get a replacement for lambda, because many other languages have jumped on the arrow bandwagon, and few Python first-time programmers have enough of a CS background to recognize the significance of the word lambda. I

[Python-ideas] Re: Alternate lambda syntax

2021-02-15 Thread Mike Miller
On 2021-02-13 14:33, Christopher Barker wrote: On Fri, Feb 12, 2021 at 1:00 AM Brendan Barnwell > wrote:         The only thing that would be better than lambda is a less confusing keyword. There seems to be a frequent objection to the word "lambda" -- pe

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Abdulla Al Kathiri
> On 15 Feb 2021, at 9:48 PM, Ricky Teachey wrote: > > hypotenuse(x,y): (x**2+y**2)**0.5 Can I use a named function (proposed here) as an argument to a function? e.g., def example(func, x, y): return func(x, y) example(hypotenuse(x,y): (x**2+y**2)**0.5, 3, 4) Or should it be an ano

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Paul Sokolovsky
Hello, On Mon, 15 Feb 2021 13:00:50 -0500 Ricky Teachey wrote: > On Mon, Feb 15, 2021 at 12:55 PM David Mertz wrote: > > > On Mon, Feb 15, 2021, 12:26 PM Ricky Teachey > > > >> f(x,y)=>x,y->str > >>> > >> > > I read this as "my cat walked across my keyboard, and I'm very > > proud she wa

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Ricky Teachey
On Mon, Feb 15, 2021 at 12:55 PM David Mertz wrote: > On Mon, Feb 15, 2021, 12:26 PM Ricky Teachey > >> f(x,y)=>x,y->str >>> >> > I read this as "my cat walked across my keyboard, and I'm very proud she > wants to be a programmer." > Our cat died last fall so if that's what happened, I should be

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread David Mertz
On Mon, Feb 15, 2021, 12:26 PM Ricky Teachey > f(x,y)=>x,y->str >> > I read this as "my cat walked across my keyboard, and I'm very proud she wants to be a programmer." > ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an em

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Ricky Teachey
On Mon, Feb 15, 2021 at 12:30 PM Guido van Rossum wrote: > On Mon, Feb 15, 2021 at 9:02 AM Ricky Teachey wrote: > >> [...] >> But if we could expand the proposal to allow both anonymous and named >> functions, that would seem like a fantastic idea to me. >> >> Anonymous function syntax: >> >> (

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Jonathan Goble
On Mon, Feb 15, 2021 at 12:29 PM Ricky Teachey wrote: > f(x,y)=>x+y->str > I can't -1 this enough. How do I read this? Imagine you have never seen this discussion and you come across this code in the wild. You are familiar with type hints, including return type annotations, but aren't familiar

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Guido van Rossum
On Mon, Feb 15, 2021 at 9:02 AM Ricky Teachey wrote: > [...] > But if we could expand the proposal to allow both anonymous and named > functions, that would seem like a fantastic idea to me. > > Anonymous function syntax: > > (x,y)->x+y > > Named function syntax: > > f(x,y)->x+y > Proposals lik

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Ricky Teachey
On Mon, Feb 15, 2021 at 12:02 PM Ricky Teachey wrote: > On Mon, Feb 15, 2021, 11:34 AM David Mertz wrote: > >> On Mon, Feb 15, 2021 at 4:19 PM Guido van Rossum >> wrote: >> >>> Okay, here’s my dilemma. It looks like this thread wants to devise a new >>> syntax for lambda, using e.g. (x, y) -> x

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Ricky Teachey
On Mon, Feb 15, 2021, 11:34 AM David Mertz wrote: > On Mon, Feb 15, 2021 at 4:19 PM Guido van Rossum wrote: > >> Okay, here’s my dilemma. It looks like this thread wants to devise a new >> syntax for lambda, using e.g. (x, y) -> x+y, or the same with =>. That’s >> great, but doesn’t open new vis

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread David Mertz
On Mon, Feb 15, 2021 at 4:19 PM Guido van Rossum wrote: > Okay, here’s my dilemma. It looks like this thread wants to devise a new > syntax for lambda, using e.g. (x, y) -> x+y, or the same with =>. That’s > great, but doesn’t open new vistas. OTOH, for people using type > annotations, a much mor

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Guido van Rossum
Okay, here’s my dilemma. It looks like this thread wants to devise a new syntax for lambda, using e.g. (x, y) -> x+y, or the same with =>. That’s great, but doesn’t open new vistas. OTOH, for people using type annotations, a much more pressing issue is an alternative for typing.Callable that is mo

[Python-ideas] Re: Conditional with statements

2021-02-15 Thread Rob Cliffe via Python-ideas
On 15/02/2021 01:58, Christopher Barker wrote: Getting OT here -- you've been warned. On Sun, Feb 14, 2021 at 2:10 AM Rob Cliffe > wrote: You've broken a number of "rules" code code formatting there ;-) Thanks for the quotation marks.  Indeed, PEP

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Steven D'Aprano
On Mon, Feb 15, 2021 at 02:12:03AM +1100, Chris Angelico wrote: > On Sun, Feb 14, 2021 at 8:42 PM Steven D'Aprano wrote: > > We should not choose the more confusing, error-prone solution out of > > fear of being different. Python is already different from Javascript in > > every regard: > > > > I