[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread miss-islington


miss-islington  added the comment:


New changeset bc60c47169d1cb33f6fbe1ed64c09a536e82e1c3 by Miss Islington (bot) 
in branch '2.7':
[2.7] bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469) 
(GH-14475)
https://github.com/python/cpython/commit/bc60c47169d1cb33f6fbe1ed64c09a536e82e1c3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread miss-islington


miss-islington  added the comment:


New changeset 3e133c401a51f08404b68f11d921f0b406283741 by Miss Islington (bot) 
in branch '3.8':
bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469)
https://github.com/python/cpython/commit/3e133c401a51f08404b68f11d921f0b406283741


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread miss-islington


miss-islington  added the comment:


New changeset e2e41cd114ae761fbfee4e7c6539f5df5c8c7116 by Miss Islington (bot) 
in branch '3.7':
bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469)
https://github.com/python/cpython/commit/e2e41cd114ae761fbfee4e7c6539f5df5c8c7116


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14293
pull_request: https://github.com/python/cpython/pull/14476

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14294
pull_request: https://github.com/python/cpython/pull/14477

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset eb97b9211e7c99841d6cae8c63893b3525d5a401 by Gregory P. Smith 
(tmblweed) in branch 'master':
bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469)
https://github.com/python/cpython/commit/eb97b9211e7c99841d6cae8c63893b3525d5a401


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14292
pull_request: https://github.com/python/cpython/pull/14475

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-29 Thread sushma


Change by sushma :


--
keywords: +patch
pull_requests: +14286
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14469

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-12 Thread Julian Berman


Julian Berman  added the comment:

I still disagree :) but docs are better than nothing.

On Wed, Jun 12, 2019, 18:05 Guido van Rossum  wrote:

>
> Change by Guido van Rossum :
>
>
> --
> nosy: +gvanrossum
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-12 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-06-12 Thread sushma


sushma  added the comment:

I'm going to try and contribute this documentation fix.

--
nosy: +syadlapalli

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2019-05-30 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The current behavior is desired.  We just need to document it better in 
https://docs.python.org/3/library/textwrap.html#textwrap.dedent

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
keywords: +easy
nosy: +docs@python, gregory.p.smith
versions: +Python 3.8 -Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2017-06-26 Thread Julian Berman

Julian Berman added the comment:

@Terry IMHO it conflicts with the fundamental description of the function.

> Remove any common leading whitespace from every line in text.

If this behavior is intentional, textwrap.dedent does not do that, it does 
that, but also some other stuff.

As for whether it *should* do that, I can't really see how it'd be a good idea 
to do this -- whether indented blank lines are like trailing whitespace or not 
is a good reason not to *add* them, but if you've got some already, 
textwrap.dedent isn't responsible for them, they were there already.

It is also extremely hard to get the other behavior given a function that does 
this one, but trivial to do the reverse.

Also, the #1 reason to use textwrap.dedent (and also the very next line of the 
docstring after the one I quoted) is to line up sections of source code. With 
this behavior, that usecase goes away any time you need trailing whitespace, 
which is exactly how I found this behavior, by unittesting a function that was 
returning:

textwrap.dedent(
"""
foo '
bar
baz


quux
 '
""",
)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2017-06-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think the current behavior is useful, but undocumented. Otherwise a blank 
line starting with unmatched whitespaces (e.g. "  foo\n\t\n  bar") would block 
deindenting.

This also matches the behavior of Python parser which ignores all whitespaces 
in blank lines.

>>> exec('if 1:\n\tpass\n  pass\n') 
>>> 
>>> 
Traceback (most recent call last):  


  File "", line 1, in


  File "", line 3   


pass


   ^


IndentationError: unindent does not match any outer indentation level   


>>> exec('if 1:\n\t\n  pass\n') 
>>> 
>>> 
>>> 

Added Antoine and Nick as yet two experts of the textwrap module.

--
nosy: +ncoghlan, pitrou, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2017-06-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is related to #19479 at least in the sense of addressing the same module, 
and being about   It has a patch, so it would be good to accept or reject. 
Martin, could you take a look?  There is currently no expert listed for 
textwrap.  Georg is current dormant as far as cpython is concerned.

To call the current behavior a bug, it should conflict with somethings in the 
docs.  Otherwise, it may be an enhancement proposal, in which case python-ideas 
would be a good place to discuss.  Julian, look in the docs to see if you find 
a conflict.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2017-06-26 Thread Emily Morehouse

Emily Morehouse added the comment:

I concur with Martin, whitespace is not expected to be preserved on 
whitespace-only lines nor even considered when finding common leading 
whitepace. To illustrate this, see the examples below:

The following yields the same (expected) results:

> python2 -c 'from textwrap import dedent; print repr(dedent(" " * 2 + "\n" 
+ " " * 4 + "\t\n"))'
> '\n\n'

And a simplified version of a test case from test_textwrap.py:

> python2 -c 'from textwrap import dedent; print repr(dedent("  Foo\n \n"))'
> 'Foo\n\n'

--
nosy: +emilyemorehouse

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2017-06-26 Thread Martin Panter

Martin Panter added the comment:

Some people like to avoid indented blank lines, treating them the same as 
trailing whitespace. I suspect this behaviour may be intentional.

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30754] textwrap.dedent mishandles empty lines

2017-06-25 Thread Julian Berman

New submission from Julian Berman:

⊙  python2 -c 'from textwrap import dedent; print repr(dedent(" " * 2 + "\n" + 
" " * 4 + "\n"))'
'\n\n'

instead of the presumed '\n  \n'

The same appears to be the case for py3.6.


(At first glance, this seems unrelated to http://bugs.python.org/issue19479 
although that issue seems to have an unreviewed patch that changes the 
implementation, so it might also "accidentally" fix the issue).

--
components: Library (Lib)
messages: 296825
nosy: Julian, georg.brandl, terry.reedy
priority: normal
severity: normal
status: open
title: textwrap.dedent mishandles empty lines
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com