On Fri, Sep 11, 2015 at 1:55 AM, Nick Coghlan wrote:
The second couldn't be handled the way virtualenv does things, but it
*could* be handled through a tool like vex which creates new subshells
and runs commands in those rather than altering the current shell:

$ python3
Python 3.4.2 (default, Jul 9 2015, 17:24:30)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import subprocess
subprocess.call(["vex", "nikola", "python"])
Python 2.7.10 (default, Jul 5 2015, 14:15:43)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
print("Hello virtual environment!")
Hello virtual environment!

Hmm. This looks like something that could confuse people no end. I
already see a lot of people use Ctrl-Z to get out of a program (often
because they've come from Windows, I think), and this would be yet
another way to get lost as to which of various Python environments
you're in. Is it safe to have Python exec to another process? That
way, there's no "outer" Python to be left behind, and it'd feel like a
transition rather than a nesting. ("Please note: Selecting a virtual
environment restarts Python.")

(Incidentally, what _would_ happen if you pressed Ctrl-Z while in that
'inner' Python? Would both Pythons get suspended?)


Search Discussions

Discussion Posts


Follow ups

Related Discussions



site design / logo © 2018 Grokbase