[Python-checkins] cpython: Minor cosmetic enhancement to provide a more readable repr()esentation of

giampaolo.rodola python-checkins at python.org
Thu Mar 27 14:14:39 CET 2014


http://hg.python.org/cpython/rev/978a08a5856f
changeset:   89991:978a08a5856f
user:        Giampaolo Rodola' <g.rodola at gmail.com>
date:        Thu Mar 27 14:14:16 2014 +0100
summary:
  Minor cosmetic enhancement to provide a more readable repr()esentation of Extension instances:

- <distutils.extension.Extension at 0x2b2088b79b00>
+ <distutils.extension.Extension('_struct') at 0x2b2088b79b00>

files:
  Lib/distutils/extension.py |  8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py
--- a/Lib/distutils/extension.py
+++ b/Lib/distutils/extension.py
@@ -131,6 +131,14 @@
             msg = "Unknown Extension options: %s" % options
             warnings.warn(msg)
 
+    def __repr__(self):
+        return '<%s.%s(%r) at %#x>' % (
+            self.__class__.__module__,
+            self.__class__.__name__,
+            self.name,
+            id(self))
+
+
 def read_setup_file(filename):
     """Reads a Setup file and returns Extension instances."""
     from distutils.sysconfig import (parse_makefile, expand_makefile_vars,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list