News for hackers. Stuff that matters.
Re:Say “no” to import side‐effects in Python by makomk on Saturday April 05, 2014 @09:49AM (#7537058)
As I understand it, "from __future__ import ..." statements are actually a special type of statement that doesn't actually import a module at all - they just use similar syntax for compatibility reasons. There is an actual __future__ module, also for compatibility reasons, but importing it has no side-effects.
Re:Say “no” to import side‐effects in Python by chrismorgan on Saturday April 05, 2014 @09:54AM (#7537075)
Future statements do import something as well, when run, but their primary purpose is changing the behaviour of the compiler for the current file. They have no behaviour outside of that file, so that is not a publicly visible side-effect.
Re:Say “no” to import side‐effects in Python by ta0967 on Saturday April 05, 2014 @03:47PM (#7538194)
Whether they import a module or not is - IMO - irrelevant. I was responding to this claim: In Python, side-effects are simply not acceptable at all. One should instead put the code with the side-effect in a function and call it. `__future__` imports are obviously and purposefully side-effectful, there's no `print_function()`.