[Python-ideas] Proposal for special name and qualname symbols
Jelle Zijlstra
jelle.zijlstra at gmail.com
Thu Jun 9 23:47:52 EDT 2016
2016-06-08 14:10 GMT-07:00 Barry Warsaw <barry at python.org>:
> On Jun 08, 2016, at 12:43 PM, Nikolaus Rath wrote:
>
> >This is so similar (in both semantics and syntax) to the
> >
> >Record = namedtuple($lhs, fields)
> >
> >proposal that I've made several times in that thread that I am a little
> >offended. Either you've not read that thread all that thorougly, or you
> >have a rather selective memory.
>
> It's of course quite easy to miss a specific suggestion in the various
> millithreads on this list, or not quite connect the dots to see the
> similarities on the initial read. Just be happy that great minds think
> alike. :)
>
> On to the topic at hand, when I saw your suggestion and Steve's I
> immediately
> thought I'd like to see a special symbol like __LHS__, e.g.
>
> Record = namedtuple(__LHS__, fields)
>
> which would at least have the benefit of not introducing a special
> character,
> and one that could be confusing in other contexts (e.g. PEP 292 strings).
>
I implemented Barry's variation of this idea at
https://github.com/JelleZijlstra/cpython/tree/lhs in case somebody wants to
play with it.
>>> Record = namedtuple(__LHS__, 'a b')
>>> Record
<class '__main__.Record' at 0x7fb12af03028>
>
> Cheers,
> -Barry
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160609/9e0266b4/attachment.html>
More information about the Python-ideas
mailing list