On Fri, Dec 12, 2014 at 1:26 PM, Andrey Novoseltsev <novos...@gmail.com> wrote:
> Hello,
>
> See https://github.com/sagemath/sagenb/pull/290#event-206993817 and links
> from there for details and examples.
>
> Basically, notebook cells have whitespace stripped from the beginning and
> the end (of the whole cell, not each line). This leads to problems with
> languages that require some spacing in front, like Fortran in this case, and
> can lead to strange results with other languages where indentation matters,
> like Python. The proposed fix for Fortran is to detect that this is Fortran
> and do only right stripping, not left.
>
> It seems to me that there should be no such stripping at all - don't mess
> with the code in a language you don't know! It is like autocorrection
> enabled by default that will "fix" your writing just because it does not
> understand that it is already correct. (Last summer I wasted a lot of time
> because password capitalization was changed by autocorrector.)
>
> Note that this issue is actually orthogonal to supporting "block
> dedent"/"prompt stripping" which is useful for copy-pasting examples from
> documentation that will all start with "sage:"
>
> Does anyone have arguments to keep stripping?

I know that "foolish consistency is the hobgoblin of little minds",
but not stripping is inconsistent with the IPython command line and
IPython notebook and Sage command line (as Karl pointed out):

~$ ipython
Python 2.7.5 (default, May  4 2014, 22:36:04)
Type "copyright", "credits" or "license" for more information.

IPython 2.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:   a=5  # there is a space at the beginning of this line.

In [2]: a
Out[2]: 5

In [3]:
Do you really want to exit ([y]/n)? y

--

In comparison, with Python:

~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>  a=5
  File "<stdin>", line 1
    a=5
    ^
IndentationError: unexpected indent
>>>

---

I'm against changing the leading strip behavior in one place but not
the other. And there's probably no way it's going to change in the
IPython command line, so...

 -- William

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to