[ python-Feature Requests-1534942 ] Print identical floats consistently

SourceForge.net noreply at sourceforge.net
Sat Aug 5 08:19:56 CEST 2006


Feature Requests item #1534942, was opened at 2006-08-05 06:19
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1534942&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Submitted By: Marc W. Abel (gihon)
Assigned to: Nobody/Anonymous (nobody)
Summary: Print identical floats consistently

Initial Comment:
Hello again and thank you,

This is a rewrite of now-closed bug #1534769.

As you know, 

>>> print .1
>>> print (.1,)

give different results because the __str__ call from
print becomes a __repr__ call on the tuple, and it
stays a __repr__ beneath that point in any recursion. 
>From the previous discussion, we need behavior like
this so that strings are quoted inside tuples.

I suggest that print use a third builtin that is
neither __str__ nor __repr__.  The name isn't
important, but suppose we call it __strep__ in this
feature request.  __strep__ would pass __strep__ down
in the recursion, printing floats with __str__ and
everything else with __repr__.

This would then

>>> print .1                and
>>> print (.1,)

with the same precision.

Marc


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1534942&group_id=5470


More information about the Python-bugs-list mailing list