I thought I understood how import worked...
Roy Smith
roy at panix.com
Tue Aug 7 11:25:43 EDT 2012
On Tuesday, August 7, 2012 9:52:59 AM UTC-4, Steven D'Aprano wrote:
> In general, you should avoid non-idempotent code. You should
> doubly avoid it during imports, and triply avoid it on days ending with Y.
I don't understand your aversion to non-idempotent code as a general rule. Most code is non-idempotent. Surely you're not saying we should never write:
>>> foo += 1
or
>>> my_list.pop()
???
Making top-level module code idempotent, I can understand (given this new-found revelation that modules aren't really singletons), but you seem to be arguing something stronger and more general.
More information about the Python-list
mailing list