[Python-ideas] Re: Accessing target name at runtime

2021-10-08 Thread Chris Angelico
On Sat, Oct 9, 2021 at 6:24 AM Jeremiah Paige wrote: > Bellow are some examples of where I believe the reflection token would be > used if adopted. > > > >>> Point = namedtuple(<<<, 'x, y, z') > >>> Point > > > > >>> UUIDType = NewType(<<<, str) > >>> UUIDType > __main__.UUIDType Not very commo

[Python-ideas] Re: Accessing target name at runtime

2021-10-08 Thread Jeremiah Paige
On Fri, Oct 8, 2021 at 2:30 PM Chris Angelico wrote: > On Sat, Oct 9, 2021 at 6:24 AM Jeremiah Paige wrote: > > Bellow are some examples of where I believe the reflection token would > be used if adopted. > > > > > > >>> Point = namedtuple(<<<, 'x, y, z') > > >>> Point > > > > > > > > >>> UUIDT

[Python-ideas] Re: Accessing target name at runtime

2021-10-08 Thread Chris Angelico
On Sat, Oct 9, 2021 at 10:02 AM Jeremiah Paige wrote: > > On Fri, Oct 8, 2021 at 2:30 PM Chris Angelico wrote: >> >> On Sat, Oct 9, 2021 at 6:24 AM Jeremiah Paige wrote: >> > Bellow are some examples of where I believe the reflection token would be >> > used if adopted. >> > >> > >> > >>> Point

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Jeremiah Paige
On Fri, Oct 8, 2021 at 4:27 PM Chris Angelico wrote: > On Sat, Oct 9, 2021 at 10:02 AM Jeremiah Paige wrote: > > > > On Fri, Oct 8, 2021 at 2:30 PM Chris Angelico wrote: > >> > >> On Sat, Oct 9, 2021 at 6:24 AM Jeremiah Paige > wrote: > >> > Bellow are some examples of where I believe the refl

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Guido van Rossum
I suspect there won’t be enough support for this proposal to ever make it happen, but at the very least could you think of a different token? The three left arrows just look too weird (esp. in the REPL examples, where they strongly seem to suggest a false symmetry with the ‘>>>’ prompt. How did you

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Chris Angelico
On Sat, Oct 16, 2021 at 8:22 AM Jeremiah Paige wrote: > > Here is a pseudo-program showing where I would like to use this token in > my own code if it existed. I think besides the cases where one is forced to > always repeat the variable name as a string (namedtuple, NewType) this > is an easy way

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Jeremiah Paige
On Fri, Oct 15, 2021 at 2:32 PM Guido van Rossum wrote: > I suspect there won’t be enough support for this proposal to ever make it > happen, but at the very least could you think of a different token? The > three left arrows just look too weird (esp. in the REPL examples, where > they strongly s

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Ricky Teachey
On Fri, Oct 15, 2021 at 6:02 PM Jeremiah Paige wrote: > > > On Fri, Oct 15, 2021 at 2:32 PM Guido van Rossum wrote: > >> I suspect there won’t be enough support for this proposal to ever make it >> happen, but at the very least could you think of a different token? The >> three left arrows just

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Jeremiah Paige
On Fri, Oct 15, 2021 at 3:37 PM Ricky Teachey wrote: > You say a soft keyword isn't an option and I understand why, but what > about one that is incredibly unlikely to have been used very often? I'm > thinking of just a simple double underscore: > > >>> a = __ > >>> a > 'a' > > This would be a br

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Jeremiah Paige
On Fri, Oct 15, 2021 at 2:53 PM Chris Angelico wrote: > On Sat, Oct 16, 2021 at 8:22 AM Jeremiah Paige wrote: > > > > Here is a pseudo-program showing where I would like to use this token in > > my own code if it existed. I think besides the cases where one is forced > to > > always repeat the v

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Steven D'Aprano
On Fri, Oct 15, 2021 at 06:37:04PM -0400, Ricky Teachey wrote: > You say a soft keyword isn't an option and I understand why, but what about > one that is incredibly unlikely to have been used very often? I'm thinking > of just a simple double underscore: > > >>> a = __ > >>> a > 'a' I frequentl

[Python-ideas] Re: Accessing target name at runtime

2021-10-16 Thread Erik Demaine
On Sat, 16 Oct 2021, Steven D'Aprano wrote: The token should preferably be: * self-explanatory, not line-noise; * shorter rather than longer, otherwise it is easier to just type the target name as a string: 'x' is easier to type than NAME_OF_ASSIGNMENT_TARGET; * backwards compatible, which

[Python-ideas] Re: Accessing target name at runtime

2021-10-16 Thread Steven D'Aprano
On Sat, Oct 16, 2021 at 09:19:26AM -0400, Erik Demaine wrote: > To me (a mathematician), the existence of this magic in def, class, import, > etc. is a sign that this is indeed useful functionality. As a fan of > first-class language features, it definitely makes me wonder whether it > could b

[Python-ideas] Re: Accessing target name at runtime

2021-10-17 Thread Serhiy Storchaka
08.10.21 22:23, Jeremiah Paige пише: Point = namedtuple(<<<, 'x, y, z') Point > > > UUIDType = NewType(<<<, str) UUIDType > __main__.UUIDType In many cases similar to namedtuple and NewType this is not enough. You need to pass to the constructor not only name, but module nam

[Python-ideas] Re: Accessing target name at runtime

2021-10-18 Thread Jeremiah Paige
On Sat, Oct 16, 2021 at 8:46 AM Steven D'Aprano wrote: > On Sat, Oct 16, 2021 at 09:19:26AM -0400, Erik Demaine wrote: > > > To me (a mathematician), the existence of this magic in def, class, > import, > > etc. is a sign that this is indeed useful functionality. As a fan of > > first-class lang

[Python-ideas] Re: Accessing target name at runtime

2021-10-18 Thread Jeremiah Paige
On Sat, Oct 16, 2021 at 6:22 AM Erik Demaine wrote: > > It's not especially short, and it's not backward-compatible, > but at least there's a history of adding double-underscore things. > Perhaps, for backward compatibility, the feature could be disabled in any > scope (or file?) where __lhs__ is

[Python-ideas] Re: Accessing target name at runtime

2021-10-18 Thread Chris Angelico
On Tue, Oct 19, 2021 at 11:30 AM Jeremiah Paige wrote: > > This could probably be toggled via a __future__ import which would make its > usage more apparent to readers of the file. But this would imply that the > keyword would eventually be turned on by default; I don't think there are any > examp