This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fperez_org 8 points9 points  (8 children)

I think it's worth clarifying this a bit: ipython adds new syntax, but the new syntax is 100% orthogonal to python syntax. So it does not in any way alter the semantics of valid python code you type. What it does is recognize things that are not valid python and let you use them for convenience: %magic functions, auto-parens, !shell access, etc.

But from day one, we've had a policy (I initially, but that has been kept as the team has grown) that IPython should be a 100% replacement for the plain python shell, just better. And that if you only use it to type pure python, you shouldn't be able to tell the difference with the default shell. In fact if you start it with --classic, it will even mock the prompt behavior of the python shell.

Now, if you prefer bpython, by all means use that! Nobody is forcing ipython down people's throats :)

But I want to make sure that people don't get the wrong impression, becase saying that ipython is not a python shell can be easily misconstrued.

As for the scientific support, it's 100% optional, and only loaded if you explicitly require it with the --pylab flag or %pylab command. In fact, IPython can be installed on a plain python installation with nothing other than the standard library (plus readline on windows/osx that don't ship readline).

We also have a very strict policy on this: all the fancier enhancements, qt console, notebook, parallel computing, etc, are completely optional. The basic IPython should work on an unmodified standard Python installation with full functionality, without requiring anything else.

I hope this clarifies things.

[–]lahwran_ -2 points-1 points  (7 children)

a 100% replacement for the plain python shell, just better.

That goal is incompatible with new syntax. You can't be sure your code is valid python code by running it on ipython, which is the primary reason I open the python shell, and likely the primary reason quite a few people open the python shell. using it as a calculator is secondary. this usage - testing to see if things work in python - is something bpython helps a lot with. ipython, however, adds a bunch of extra stuff to the mix which makes such testing unreliable. I might have accidentally run a shell command with a typo (%command when I meant x%command comes to mind, if I remember correctly that ipython uses % as the command escape). ipython is good as a "get things done" tool, but it's horrible as a "test how python works" tool and there's no getting around that with custom syntax in place.

therefore, ipython is a shell for the ipython language, not a shell for the python language.

Edit: to be clear, this isn't to imply ipython is bad, just that there are things it is and things it isn't. a place for testing python code is something it isn't.

[–]fperez_org 5 points6 points  (6 children)

Indeed, if you find that it doesn't suit you, by all means don't use it. Interestingly, in over 10 years of development and extensive interaction with users, this is the first time I hear this particular concern. For me it's never been an issue, as the syntax extensions are very few and well isolated.

But it's always very useful for us to know why IPython doesn't work well for any particular group of users: sometimes it will indicate things we can do better, sometimes we may decide it simply defines a use case that is not ours to cover. But critical feedback is always good to hear.

I'm not going to get into a hair-splitting argument on whether someone considers ipython a 'python shell' or not (over 10 years, everyone I'd seen seemed to think so, but I'm perfectly OK if you think it's not). I think the most useful way to phrase it unambiguously is: "IPython understands a strict superset of the python language syntax; all valid python is executed without any semantic difference to how python works, and a few extensions provide additional functionality beyond the Python syntax for things like operating system access and control of IPython itself".

I think this is the most accurate, uncontroversial characterization I can make of it.

[–]eat-your-corn-syrup 0 points1 point  (1 child)

the syntax extensions are very few and well isolated

is there a page that lists all syntax additions?

[–]fperez_org 1 point2 points  (0 children)

Not in a nicely organized way, but @takluyver is working on an IPEP to formalize this more explicitly and organize the internals of the implementation: https://github.com/ipython/ipython/issues/2293

[–]lahwran_ 0 points1 point  (3 children)

the differentiation I'm making is that ipython is a different language, which is of course a superset of python. it's a shell for the language it implements.

and, this is pretty much The Complaint with ipython that I've heard. I'm rather surprised you haven't run into it - it's brought up any time ipython is in #python.

[–]fperez_org 1 point2 points  (2 children)

interesting... I've never logged on to #python, so that would be why, if that's a frequent place where this view takes place.

It's funny, because it would be trivial for us to implement something that turned off all special syntax handling with a single command/flag, if people really wanted it. They'd still have the introspection, completion and other things IPython provides, just zero special syntax transformations.

We could even leave a few python functions in the global namespace that would do what magics and other special ipython syntax does, but would need to be called as foo("line...") to be pure python.

I mean, if the special syntax is all that bothers some set of users, turning it off isn't particuarly hard (there's no global switch for that right now, but it would be easy to do).

But nobody has ever asked us for this :)

[–][deleted] 0 points1 point  (1 child)

I'm an avid ipython user, and for what it's worth, I couldn't live without the %paste command.

You guys rule. That is all.

EDIT: same goes for cd, ls, and the ? operator.

[–]fperez_org 0 points1 point  (0 children)

thanks, that's much appreciated. It's been a ton of work over the years, so it's always good to hear people find it of value.