Discussion:
[Bitpim-devel] Re: [bitpim-cvs-checkins] bitpim com_samsungscha310 .py,1.7,1.8
d***@netzero.com
2004-11-18 06:13:27 UTC
Permalink
Roger, thanks for pointer, I'll update those code sections. I read that the string module provides better performance than string object methods, and I'm all for speed!! :-)

-Joe Pham
+from string import split,atoi,strip,join,replace
BTW that is really bad form in Python.
+ name=replace(pb_entry['names'][0]['full'], '"', '')
All you do is:

name=pb_entry['names'][0]['full'].replace('"', '')

It may not be immediately apparent in Python, but strings are immutable (ie
can't be changed). All the operations listed (split, strip, join etc)
return new strings and do not modify themselves in place.

In fact there is never any need to use the string module, and it is going
to be removed soon.

Roger


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Bitpim-devel mailing list
Bitpim-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitpim-devel


________________________________________________________________
NetZero Platinum $9.95.
NetZero HiSpeed $14.95.
Sign up Today at http://www.netzero.net or
Visit Sam Goody, Suncoast or MediaPlay Stores.
Roger Binns
2004-11-18 07:34:26 UTC
Permalink
Post by d***@netzero.com
Roger, thanks for pointer, I'll update those code sections.
I read that the string module provides better performance than
string object methods, and I'm all for speed!! :-)
The latter statement is bull except under very specific
circumstances.

You can run the profiler to see where the CPU time goes.
Edit the bottom of bp.py and it will dump everything out.

The only gotcha (which I found out a few weeks ago) is
that the Python profiler only profiles the thread it is
invoked in. That means the output you get will only be
for the gui thread. At some point I'll add something
for profiling the phone interaction thread as well.

Roger

Loading...