[Patches] [ python-Patches-750542 ] Let pprint.py use issubclass instead of is for type checking
SourceForge.net
noreply@sourceforge.net
Sat, 07 Jun 2003 13:31:41 -0700
Patches item #750542, was opened at 2003-06-07 15:11
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=750542&group_id=5470
Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Gerrit Holl (gerrit)
Assigned to: Nobody/Anonymous (nobody)
Summary: Let pprint.py use issubclass instead of is for type checking
Initial Comment:
Hi,
subclasses of dict, list, tuple etc. should be
pretty-printed according to the same rules as dict,
list and tuple themselves. Because of that, this patch
changes pprint.py so that rather than checking types
using 'typ is list', pprint checks types using
'issubclass(typ, list)'.
Gerrit Holl
Patched against latest CVS ( 07/06/2003 13:11:24 UTC)
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2003-06-07 22:31
Message:
Logged In: YES
user_id=21627
Thanks for the patch. Applied as pprint.py 1.25.
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2003-06-07 22:30
Message:
Logged In: YES
user_id=3066
>From python-dev:
http://mail.python.org/pipermail/python-dev/2003-June/036008.html
Hmm; this patch was never assigned to me, so I was unaware
that anyone thought there was a problem with this.
I specifically considered making changes like these when
subclassing built-in types became possible, but decided
against it since it didn't appear reasonable to assume that
__repr__() hadn't been redefined. I'm sure it's possible to
check, but to do so cleanly and efficiently seems like a
huge change to the module for little value.
I think the patch, as it stands, should be reverted. If
another patch appears that addresses the issue of overridden
__repr__() methods, it should be considered again.
-1 for the patch as applied.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=750542&group_id=5470