This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients brett.cannon, rhettinger, vstinner
Date 2019-04-09.01:19:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554772753.38.0.686035359768.issue36559@roundup.psfhosted.org>
In-reply-to
Content
In general, deferred imports are code smell that should avoided unless really necessary. They create an on-going maintenance burden (there's a reason most modules don't do this and put their imports at the top).

FWIW, a broken hashlib is a localized bug, not an optimization problem. It doesn't affect any user with a build that passes the test suite.

Running "python -v" shows that "random" is not part of the normal startup, so deferring the import saves zero for normal startup. It only affects modules that specifically import random.

IIRC, Mercurial uses hashing extensively, so deferring the import doesn't help them at all.

This is minor change, so I suppose we could let it go through; however, it seems somewhat arbitrary and the reasons offered seem dubious. For the most part, it isn't a good practice.
History
Date User Action Args
2019-04-09 01:19:13rhettingersetrecipients: + rhettinger, brett.cannon, vstinner
2019-04-09 01:19:13rhettingersetmessageid: <1554772753.38.0.686035359768.issue36559@roundup.psfhosted.org>
2019-04-09 01:19:13rhettingerlinkissue36559 messages
2019-04-09 01:19:13rhettingercreate