[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Anders Hovmöller
> On 2 Feb 2020, at 01:00, Christopher Barker wrote: > > And no one answered my questions about what it would do in all the, very > common cases where an object doesn't ahve a name, opr more than one. This question has been answered multiple times. It's not about the object, it's about the

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Christopher Barker
On Fri, Jan 31, 2020 at 9:50 PM Richard Damon wrote: > On 1/31/20 9:28 PM, Christopher Barker wrote: > > I am really confused by this whole thread: > > My understanding is that the impetus of the request is that if you start > from an expression like nameof(foo.bar) to get to "bar" then if

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Guido van Rossum
The whole feature. On Sat, Feb 1, 2020 at 14:35 Greg Ewing wrote: > On 2/02/20 6:12 am, Guido van Rossum wrote: > > > Alex, this is not ever going to be added to Python, > > For clarity, are you rejecting the whole idea of a "nameof" feature, > or just bytecode-hack implementations of it? > >

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Greg Ewing
On 2/02/20 6:12 am, Guido van Rossum wrote: Alex, this is not ever going to be added to Python, For clarity, are you rejecting the whole idea of a "nameof" feature, or just bytecode-hack implementations of it? -- Greg ___ Python-ideas mailing list

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Guido van Rossum
Alex, this is not ever going to be added to Python, no matter how well your hack seems to work. This is the main point of all the feedback you’re getting, even though it may be obscured by the critique of your example code. Since at this point we’re debating a 3rd party extension, it is not

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Richard Damon
On 1/31/20 10:58 PM, Andrew Barnert via Python-ideas wrote: When refactoring code to rename something, there is no way to tell whether a string—or a substring in a larger string—that matches the name should be changed. But a nameof expression is unambiguously a reference to the name, and

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Alex Hall
> > So this is not likely to ever work in IronPython or Jython. > > There are no stability guarantees about the byte-code generated by > CPython, so you may be chasing a moving target here. > > You ought to test your code before posting, because I've tried it in > 3.5, 3.7 and 3.8 and I get the