[Python-bugs-list] [ python-Bugs-458430 ] convert library to use inplace ops

noreply@sourceforge.net noreply@sourceforge.net
Tue, 04 Sep 2001 09:27:57 -0700


Bugs item #458430, was opened at 2001-09-04 09:16
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=458430&group_id=5470

>Category: Python Library
>Group: Not a Bug
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Grant Griffin (dspguru)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: convert library to use inplace ops

Initial Comment:
The Python library contains a large number of lines 
which could be converted to use inplace operators 
("+=" and friends).  That would make the library 
modules marginally smaller and faster.

The attached program identifies these cases and prints 
out a list.  It has found 647 instances in 91 files of 
the 2.2a2 library.

There are so many of these that I recommend that a 
tool be made to automatically convert these things.  
Failing that, perhaps at least the most frequently-
used modules could be manually converted.  (For 
example, sre and fnmatch [used by glob] contain a few 
of these.)

If there's any interest in a conversion tool, I could 
take a shot at doing it.  (It could be done fairly 
easily by adapting the attached program.)

thanks,

=g2

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-04 09:27

Message:
Logged In: YES 
user_id=6380

Nice tool, but I am against doing a large-scale massive
conversion on the library. We did something like this once
before (for string methods) and we still found conversion
bugs months later. The performance benefits will be
unmeasurable, so I don't see much benefit from doing this at
all. The risk is clear: a botched conversion introduced a
new bug.

I think it's up to the "owners" of individual modules to
decide whether they want to manuallly convert their code to
using the new paradigm.

And why would we do this? It's not like the old way is going
to be outlawed in the future!

Also note that the SRE codebase in particular still has to
run on Python 1.5.2, which doesn't have augmented
assignments.

For all these reasons, I'm rejecting this.

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=458430&group_id=5470