[issue25548] Show the address in the repr for class objects

2016-07-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4f11e6b72e8f by Benjamin Peterson in branch 'default':
Backed out changeset af29d89083b3 (closes #25548) (closes #27498)
https://hg.python.org/cpython/rev/4f11e6b72e8f

--
nosy: +ned.deily
resolution:  -> fixed
stage: commit 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



[issue25548] Show the address in the repr for class objects

2016-07-13 Thread Ned Deily

Changes by Ned Deily :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-07-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks, let's roll it back.

The reason it never was an issue for old-style classes is that they
behaved like this from the start, so nobody wrote tests that depended
on the predictability of repr(). But new-style classes have had this
nice clean repr() since they were introduced (in 2.3?) so it's
unsurprising that this is now depended upon.

Here's a link to some test code for mypy that broke:
https://github.com/python/mypy/blob/master/mypy/util.py#L22-L23

It may be irreprehensible code but it works for Python 3.2-3.5 (and
for new-style classes in Python 2, except mypy requires Python 3), and
broke in 3.6.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-07-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 on rolling this back.  It sounds like it hurt more than it would have helped.

To satisfy my curiosity, can you post one of the tests that broke.  It would be 
nice to see what kind of tests are depend the repr of the class.  AFAICT, there 
was never an issue with this for old-style classes in Python2.7, so something 
new must be occurring in the wild.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-07-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Doing it only for user-defined types would still break my tests.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-07-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Would there be a way to confine this to just heap types?  The user defined 
classes are where there is the most benefit.  For the built-in types, it just 
seems to add noise.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-07-12 Thread Kushal Das

Kushal Das added the comment:

The NEWS file got a typo. Thanks for noticing that.
This change did require a lot of updates to the tests.
If rest of the people agrees to revert this change, then we should go ahead and 
do it. Just wondering if Raymond has anything to add.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-07-12 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm also echoing this... It breaks too many tests. I filed issue27498.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-22 Thread Tim Graham

Tim Graham added the comment:

I'll echo what Peter said and say that this breaks 5 tests in Django's test 
suite which are checking error messages. If it stays, perhaps it could be added 
to the release notes instead of just NEWS.

--
nosy: +Tim.Graham

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-17 Thread Martin Panter

Martin Panter added the comment:

There is also Issue 13224 proposing to change __str__() to just return the 
__name__ or __qualname__ if I remember correctly.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-17 Thread Peter Eisentraut

Peter Eisentraut added the comment:

I understand the reasoning here, but I want to say booh to this change in 
3.6.0a2 because it breaks my tests.  It used to be that type(x) returned a 
predictable string, and that was an easy way to verify the result types of 
things.

Perhaps a __str__ implementation could be added that avoids the memory address?

--
nosy: +petere

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-07 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Hi guys, the title of the issues is "show address in the **repR**", but the 
NEWS file says[1] in the **repL*, which are 2 different things ! :-)

And this patch change the repR so it also affect scripts and unittests. 

[1] since https://hg.python.org/cpython/rev/af29d89083b3

--
nosy: +mbussonn

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-05 Thread Nofar Schnider

Nofar Schnider added the comment:

Kushal, you've beat me to it. Great work!

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset af29d89083b3 by Kushal Das in branch 'default':
Issue #25548: Showing memory address of class objects in repl
https://hg.python.org/cpython/rev/af29d89083b3

--
nosy: +python-dev

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Nofar said not to wait for her on this one.

--
assignee: rhettinger -> kushal.das

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks Kushal.   It looks like we had a race condition ;-)   I'll assign it 
back after Nofar's work is in and reconciled.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Kushal Das

Kushal Das added the comment:

Hey Raymond, I am uploading the patch which I almost committed along with whats 
new update :)
I am also reassigning the ticket to you so that you can decide the next steps.

--
assignee: kushal.das -> rhettinger
Added file: http://bugs.python.org/file43153/issue25548v4.patch

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Nofar is about to upload her patch as well (she's been working on this for a 
while).  Perhaps the two can be compared and reconciled so that both can be 
credited on the commit.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Kushal.  If you don't mind, I would like Nofar to be able to do this patch.  
She's been working on it since before the sprints and was slowed down by a 
schoolwork crunch.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Brett Cannon

Brett Cannon added the comment:

Patch LGTM. Just needs doc and What's New updates.

--
assignee:  -> kushal.das
nosy: +brett.cannon
stage: patch review -> commit review

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Emanuel Barry

Emanuel Barry added the comment:

I'd probably change all instances of ".*" in the regex matches to be "0x.+" 
instead. For the docstrings that have "..." in them, I would probably make 
those " at ..." as well (although you get decide if it hinders readability too 
much).

Other than that patch LGTM.

--
nosy: +ebarry
stage:  -> patch review

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Kushal Das

Kushal Das added the comment:

Uploading the new patch with a new test case for the same.

--
Added file: http://bugs.python.org/file43151/issue25548v2.patch

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-02 Thread Kushal Das

Kushal Das added the comment:

Attaching the patch for the same. Had to update the test cases for the 
following tests to have this behavior as expected.

test_functools 
test_cmd_line_script 
test_ctypes 
test_defaultdict 
test_descr
test_descrtut 
test_doctest 
test_generators
test_genexps 
test_metaclass 
test_pprint 
test_reprlib
test_statistics 
test_trace 
test_wsgiref

--
keywords: +patch
nosy: +kushal.das
Added file: http://bugs.python.org/file43119/issue25548.patch

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-05-31 Thread Nofar Schnider

Changes by Nofar Schnider :


--
nosy: +Nofar Schnider

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-05-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I don't quite get why the memory address is helpful

For the same reason that we've found the address to helpful in other reprs, it 
helps people understand that classes are objects just like anything else and to 
know which objects are distinct.

My instructors have found that this matters when teaching Python and more than 
one of them immediately noticed the loss of information when switching from 
teaching Python 2 to Python 3.

--

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-05-19 Thread ppperry

ppperry added the comment:

I don't quite get why the memory address is helpful, but you could work around 
this using a custom metaclass:

class IdMeta(type):
def __repr__(cls):
return super().__repr__()[:-1] + " at 0x%x>"%id(cls)
class IdInRepr(metaclass=IdMeta):pass

`IdInRepr` and all its subclasses will then have the memory address in their 
representation:

  

--
nosy: +ppperry

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-05-18 Thread Camilla Montonen

Changes by Camilla Montonen :


--
nosy: +Winterflower

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2015-11-06 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In 3.x, old style classes are gone, so you get a new style class with or 
without '(object)'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2015-11-03 Thread Raymond Hettinger

New submission from Raymond Hettinger:

In old-style classes, the memory address of the class object is shown for both 
the class and for the instance.  In new-style classes, only the instance shows 
the address.  I and other Python instructors have found the memory address 
display to be useful and I think it should be added back:

Old-style
=
 
  >>> class A:
pass

  >>> a = A()
  >>> A
  
  >>> a
  <__main__.A instance at 0x105292cb0> 


New-style
=

  >>> class A(object):
pass

  >>> a = A()
  >>> A
  
  >>> a
  <__main__.A object at 0x105332cd0>

--
messages: 254012
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Show the address in the repr for class objects
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2015-11-03 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Raymond,

I just executed the code with python 3.5 and I don't have this result:

Python 3.5.0 (default, Sep 23 2015, 04:41:38)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class A: pass
...
>>> A

>>> class A(object): pass
...
>>> A

>>>

--
nosy: +matrixise

___
Python tracker 

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