A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-July/148597.html below:

[Python-Dev] Impact of Namedtuple on startup time

[Python-Dev] Impact of Namedtuple on startup time [Python-Dev] Impact of Namedtuple on startup timeAntoine Pitrou antoine at python.org
Mon Jul 17 09:31:35 EDT 2017
Le 17/07/2017 à 15:26, Isaac Morland a écrit :
> 
> I think I understand well enough to say something intelligent…
> 
> While actual references to _source are likely rare (certainly I’ve never
> used it), my understanding is that the way namedtuple works is to
> construct _source, and then exec it to create the class. Once that is
> done, there is no significant saving to be had by throwing away the
> constructed _source value.

The proposed resolution on https://bugs.python.org/issue28638 is to
avoid exec() on most parts of the namedtuple class, hence speeding up
the class creation.

> I come from
> a non-Pythonic background so use of exec still feels a bit weird to me
> but I absolutely love namedtuple and use it constantly.

I think for most Python programmers, it still feels a bit un-Pythonic.
While exec() is part of Python, it's generally only used in fringe cases
where nothing else works.

Regards

Antoine.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4