> On 21 Jan 2020, at 22:50, Andrew Barnert via Python-ideas > <[email protected]> wrote: > > But it seems like nameof(self.age) always has to be just “age”, which you > already have to type inside the nameof if you want it to be findable, so > it’ll never be useful. Anywhere you could write `{nameof(self.age)}` you > could just more simply write `age`.
That misses the point. Refactoring tools for example won't know how to handle the rename of the variable foo in this example: foo = 1 n = 'foo' print(n, foo) If you had n = nameof(foo) It would know what to do. That's why this feature exists in C# and AFAIK also in Swift for example. / Anders _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/MOUV45AYQPFE7TDXDIKT3JNGBLSFRTWD/ Code of Conduct: http://python.org/psf/codeofconduct/
