On 13/09/2023 17:21, MRAB wrote:
I think the point is to have an equivalent to C#'s 'nameof'.
It would be evaluated at compile time to a string, but with the
advantage that it's clear that it's a name and not some random string
that just happens to look like a name.
I'd like to draw attentio
On Sat, 16 Sept 2023 at 08:50, Jeff Allen wrote:
> The parallel with f-string = is helpful, for which compile-time support is
> essential, of course.
It's really something that needs editor support, not compiler support.
As far as the Python interpreter is concerned, this is just a string.
So w
Yes, I agree. This was exactly what I had in mind. Was good to find out that
there is such implementation in other language.
DG.
> On 15 Sep 2023, at 17:00, Jeff Allen wrote:
>
> On 13/09/2023 17:21, MRAB wrote:
>> I think the point is to have an equivalent to C#'s 'nameof'.
>>
>> It would b
> def nameof(x): return x
>
> print("This " + nameof("thing") + " is:", thing)
Can you explain what you meant by this code? How would this work in editor?
>
> ChrisA
> ___
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send a
On Sat, 16 Sept 2023 at 10:07, Dom Grigonis wrote:
>
>
> > def nameof(x): return x
> >
> > print("This " + nameof("thing") + " is:", thing)
> Can you explain what you meant by this code? How would this work in editor?
>
Frankly, I have no idea, because your **entire proposal** is
predicated on so
So following this thread, from your perspective and from what has been said you
can’t see or noticed any parts of it needing interpreter?
DG
> On 16 Sep 2023, at 03:14, Chris Angelico wrote:
>
> On Sat, 16 Sept 2023 at 10:07, Dom Grigonis wrote:
>>
>>
>>> def nameof(x): return x
>>>
>>> pri
On Sat, 16 Sept 2023 at 10:20, Dom Grigonis wrote:
>
> So following this thread, from your perspective and from what has been said
> you can’t see or noticed any parts of it needing interpreter?
Correct. Trying to get a variable name from an object is nonsensical,
and trying to get a variable na