[Patches] [ python-Patches-574214 ] Dis.py to use dictionary membership test
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 26 Jun 2002 19:14:43 -0700
Patches item #574214, was opened at 2002-06-26 14:48
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=574214&group_id=5470
Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: Dis.py to use dictionary membership test
Initial Comment:
Replaced linear search with hash lookup in dis.py
Membership testing now works at O(1) instead of O
(n).
Neal, would you give the second review?
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-06-26 22:14
Message:
Logged In: YES
user_id=33168
The code looks correct, however, I'm not sure it's worth
making the change. Part of the problem is these attributes
are doc'ed to be sequences (libdis.tex). Also most of these
are very short. I don't suspect the change would affect
many programs (either in speed improvements or backwards
compatibility problems). This change doesn't affect
pychecker since I removed the dependancy on the dis module.
At one time, this change could have affected pychecker, I
don't remember. It could affect other apps.
Here's a slightly different view to get an idea of the list
sizes. These are from pychecker's code, so they may not be
correct, but should be close:
_HAS_NAME = (90, 91, 95, 96, 97, 98, 101, 105, 107, 108, 116,)
_HAS_LOCAL = (124, 125, 126,)
_HAS_CONST = (100,)
_HAS_COMPARE = (106,)
_HAS_JREL = (110, 111, 112, 114, 120, 121, 122,)
_HAS_JABS = (113, 119,)
If this change were made, you would need to update the
libdis.tex as well as NEWS.
I think a PythonLab'er should probably review further.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=574214&group_id=5470