[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    Re: [Python-ideas] reprs of recursive datastructures.
From:       Raymond Hettinger <raymond.hettinger () gmail ! com>
Date:       2012-09-09 5:04:34
Message-ID: CF275729-EAA3-4CF4-AAB0-20FA831D3AAF () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sep 8, 2012, at 6:02 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:

> The thing I don't like is that the current display flat out lies about
> the sequence contents - it displays a terminal constant ("..."),
> rather than a clear marker that a recursive loop was detected.

It's more of an equivocation than a flat-out lie ;-)

It is an equivocation because "..." is legitimately used
for multiple purposes (in English text for "and so on ...",
in long established use in Python to denote recursive reprs,
in doctest as a placeholder for elided result text, and in
its newest role as the Ellipsis terminal constant).

It seems to me that the first three roles are well-established
and are reasonably consistent with one another.    Further,
each of those roles an important task.

In contrast, the new role as a terminal constant for an
Ellipsis singleton is brand-new, not very important,
and doesn't even have a clear semantic role (what it is
"supposed" to mean?).

Changing the first three uses just so it won't conflict with the last
seems like the tail wagging the dog.

I agree Steven that this isn't a problem worth solving.

As Alexander pointed-out, the ... punctuation can be used in two
distinct ways inside doctests (as part of expected output or as
a placeholder for elided content).  A consequence is that 
there won't be a reliable automated way to convert existing 
doctests for a new notation for recursive reprs. 

ISTM that changes which break tests are worse than other
changes because the process of upgrading from one Python
version to the next is so heavily dependent getting existing tests
to pass.  The tests are your safety net during upgrades -- breaking them
makes upgrading less palatable.


Raymond





[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 8, 2012, at 6:02 \
AM, Nick Coghlan &lt;<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>&gt; \
wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span \
style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: \
normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: \
normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; display: inline !important; float: none; ">The thing \
I don't like is that the current display flat out lies about</span><br \
style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: \
normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: \
normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; "><span style="font-family: Helvetica; font-size: \
medium; font-style: normal; font-variant: normal; font-weight: normal; \
letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; \
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: \
0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline \
!important; float: none; ">the sequence contents - it displays a terminal constant \
("..."),</span><br style="font-family: Helvetica; font-size: medium; font-style: \
normal; font-variant: normal; font-weight: normal; letter-spacing: normal; \
line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; \
text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span \
style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: \
normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: \
normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; display: inline !important; float: none; ">rather \
than a clear marker that a recursive loop was \
detected.</span></blockquote></div><br><div>It's more of an equivocation than a \
flat-out lie ;-)</div><div><br></div><div>It is an equivocation because "..." is \
legitimately used</div><div>for multiple purposes (in English text for "and so on \
...",</div><div>in long established use in Python to denote recursive \
reprs,</div><div>in doctest as a placeholder for elided result text, and \
in</div><div>its newest role as the Ellipsis terminal \
constant).</div><div><br></div><div>It seems to me that the first three roles are \
well-established</div><div>and are reasonably consistent with one another. &nbsp; \
&nbsp;Further,</div><div>each of those roles an important \
task.</div><div><br></div><div>In contrast, the new role as a terminal constant for \
an</div><div>Ellipsis singleton is brand-new, not very important,</div><div>and \
doesn't even have a clear semantic role (what it is</div><div>"supposed" to \
mean?).</div><div><br></div><div>Changing the first three uses just so it won't \
conflict with the last</div><div>seems like the tail wagging the \
dog.</div><div><br></div><div>I agree Steven that this isn't a problem worth \
solving.</div><div><br></div><div>As Alexander pointed-out, the ... punctuation can \
be used in two</div><div>distinct ways inside doctests (as part of expected output or \
as</div><div>a placeholder for elided content). &nbsp;A consequence is \
that&nbsp;</div><div>there won't be a reliable automated way to convert \
existing&nbsp;</div><div>doctests&nbsp;for a new notation for recursive \
reprs.&nbsp;</div><div><br></div><div>ISTM that changes which break tests are worse \
than other</div><div>changes because the process of upgrading from one \
Python</div><div>version to the next is so heavily dependent getting existing \
tests</div><div>to pass. &nbsp;The tests are your safety net during upgrades -- \
breaking them</div><div>makes upgrading less \
palatable.</div><div><br></div><div><br></div><div>Raymond</div><div><br></div><div><br></div><div><br></div><div><br></div></body></html>




_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic