
On Sun, 10 Apr 2022 at 09:31, Daniel Pope <lord.mauve@gmail.com> wrote:
I would like to bid again for (import package.module) as an expression. Instead of doing the import and assigning package to a variable package it would evaluate to the module object package.module.
I like this proposal and I agree with previous posters about hoisting being undesirable. And if lazy importing is slow then that is probably something that can be optimized away; of course in tight loops or performance-sensitive code you wouldn't use this functionality. But perhaps using "from" makes the behavior more clear (and it is shorter): start_date = from datetime.datetime(2012, 1, 6) I think the behavior could be to simply keep importing until we have a non-module value, rather than rely on putting the import name in parentheses. Cheers