<div dir="ltr">My apologies, I misunderstood what had been proposed (and rejected).<div><br></div><div>So it sounds like the _source is a pre-requisite for the current exec-based implementation, but the proposal is to replace with a non-exec-based implementation, meaning _source would no longer be needed for the module to work and might be eliminated. But _source could continue to be generated lazily (and cached if thought helpful) using an @property, so even the (apparently rare) uses of _source would continue to work.</div><div><br></div><div>This would in some sense be a DRY violation, but of a very pragmatic Pythonic sort, where we have two implementations, one for documentation and one for efficiency. How different would this be from all those modules that have both Python and C implementations?</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 17 July 2017 at 09:31, Antoine Pitrou <span dir="ltr"><<a href="mailto:antoine@python.org" target="_blank">antoine@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
Le 17/07/2017 à 15:26, Isaac Morland a écrit :<br>
><br>
> I think I understand well enough to say something intelligent…<br>
><br>
> While actual references to _source are likely rare (certainly I’ve never<br>
> used it), my understanding is that the way namedtuple works is to<br>
> construct _source, and then exec it to create the class. Once that is<br>
> done, there is no significant saving to be had by throwing away the<br>
> constructed _source value.<br>
<br>
</span>The proposed resolution on <a href="https://bugs.python.org/issue28638" rel="noreferrer" target="_blank">https://bugs.python.org/<wbr>issue28638</a> is to<br>
avoid exec() on most parts of the namedtuple class, hence speeding up<br>
the class creation.<br>
<span class=""><br>
> I come from<br>
> a non-Pythonic background so use of exec still feels a bit weird to me<br>
> but I absolutely love namedtuple and use it constantly.<br>
<br>
</span>I think for most Python programmers, it still feels a bit un-Pythonic.<br>
While exec() is part of Python, it's generally only used in fringe cases<br>
where nothing else works.<br>
<div class="HOEnZb"><div class="h5"><br>
Regards<br>
<br>
Antoine.<br>
______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/isaac.morland%40gmail.com" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>isaac.morland%40gmail.com</a><br>
</div></div></blockquote></div><br></div>