> On 22 Jan 2020, at 11:50, Steven D'Aprano <st...@pearwood.info> wrote:
> 
> But what should these things do?
> 
>    x = y = z = 1
>    nameof(1)

Syntax error.

>    nameof(z)

"z"

>    nameof("Gumby")

Syntax error.

>    nameof(mysequence[0])

Syntax error.

> It isn't clear what precisely counts as the name of a variable.
> 
> Johan's nameof operator looks like a function. But it can't be a 
> function, for obvious reasons.
> 
> Or at least, they're obvious to me, I don't know if Johan understands 
> why a regular function can't easily/efficiently/unambiguously return the 
> name of an object.
> 
> Johan, it would be nice when making a proposal if you spelled out 
> precisely what you expect it to do, as well what you don't expect it to 
> do, especially if we don't know you well enough to predict if you are an 
> expert or a novice. Otherwise we risk either talking down to you, or 
> talking over your head.

He was pretty clear in saying he wanted the same thing as in C#. That no one in 
this thread seems to have looked that up is really not his fault in my opinion. 

/ Anders 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/U52FTXEB6553QSOTYWDYWAD4HL6FV36D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to