Yes, Thank you! So 2 solutions now. They both solve what I have encountered. Beyond that, they differ by:
a) f-string print(f’{=a.method}’) # ‘a.method’ No new builtin needed. Simply reprints expression representation. b) print(nameof(a.method)) # ‘method’ New builtin. Has its own logic. Its extra functionality on top of what I have suggested can already achieved in python via a.method.__name__ I think f-string approach if optimal. It adds new feature, without functionality overlap and doesn’t crowd the namespace. Also, implementation is simpler as all what is required seems to be in the place already. I have little preference regarding syntax, but f’{=expression}’ does seem to make sense. Regards, DG > On 12 Sep 2023, at 13:14, Valentin Berlier <berlie...@gmail.com> wrote: > > Do you mean something like C# nameof()? > https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof > _______________________________________________ > 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/USPQDMEA7ACWH2T56ZYTWBGG7SMT3RIF/ > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ 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/P7KERJ2O5QWON5CZGM5LTMNVP4AZXHSK/ Code of Conduct: http://python.org/psf/codeofconduct/