Reason for not allowing import twice but allowing reload()

Ian Kelly ian.g.kelly at gmail.com
Tue Mar 1 16:53:06 EST 2016


On Mar 1, 2016 4:41 AM, "Chris Angelico" <rosuav at gmail.com> wrote:
>
> On Tue, Mar 1, 2016 at 10:18 PM, Steven D'Aprano <steve at pearwood.info>
wrote:
> > I cannot imagine why you would want to reload() in production code. That
> > would imply that your production code is modifying already-imported
> > modules, then wanting to import them again. Why would anyone in their
right
> > mind do that? Possibly because they lost a bet?
>
> BartC and I have both done this exact thing, though neither of us used
> Python for it. It's not so insane as you might think; sometimes you
> want to update code, but you don't want to restart a process. Just
> because you've never had a process that hits a year of uptime doesn't
> mean nobody else does. :)

I have a hard time understanding the appeal of super-long uptimes. I'm not
even comfortable running a single kernel version that long. What's so awful
about 5 minutes of announced downtime in the middle of the night once a
month while the system restarts?



More information about the Python-list mailing list