Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define generic sys.ps{1,2,3}, for use by scripts. #1717

Merged
merged 1 commit into from May 10, 2012

Conversation

bfroehle
Copy link
Contributor

Issue #123 suggests that we set sys.ps{1,2} to be consistent with python. This way scripts can tell that they are being run in an interactive session (when run using execfile or %run).

I'm not sure that I agree with this mentality, but there is likely little lost in setting the values.

Values are clearly irrelevant, but I took the constants from IPython/zmq/frontend.py.

@fperez
Copy link
Member

fperez commented May 10, 2012

I'm also not completely thrilled by this approach, but we do try to minimize inconsistencies wrt plain python, so we might as well do it.

@fperez
Copy link
Member

fperez commented May 10, 2012

I was just thinking that the [], absent actual numbers inside, look a bit nonsensical. hence my suggestion to go with bare In : and Out:. Those original constants were part of a toy prototype that @ellisonbg and I wrote back in early 2010, when we built the first proof of concept of a 2-process interactive python shell using zmq. Since we just wanted to see if it ran and the basics worked, we put a simple static prompt, but made it different from the regular python >>> one to remind us visually that it wasn't the normal shell. So there's no real importance to those old prompts, and I think we should lean more towards consistency with actual ipython use.

But this is a very minor point, of course :)

@bfroehle
Copy link
Contributor Author

Thanks for the history. I've updated the values as you suggested.

@fperez
Copy link
Member

fperez commented May 10, 2012

Looks good, thanks! Merging now.

@fperez
Copy link
Member

fperez commented May 10, 2012

Actually, hold on: now that I think of it, should we really define sys.ps3? It's not part of the default python, and anyone actually using IPython should go through our own mechanisms. Since the purpose of declaring sys.ps{1,2} is only compatibility with plain Python, I'm not sure it makes sense to add anything beyond what Python does.

@bfroehle
Copy link
Contributor Author

One "benefit" of sys.ps3 is a user could use it to differentiate between python and IPython...

Shrug. I'm completely indifferent on the matter.

@fperez
Copy link
Member

fperez commented May 10, 2012

OK, good point :) I'll merge now.

fperez added a commit that referenced this pull request May 10, 2012
Define generic sys.ps{1,2,3}, for use by scripts.

Closes #123.
@fperez fperez merged commit ea9c293 into ipython:master May 10, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Define generic sys.ps{1,2,3}, for use by scripts.

Closes ipython#123.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants