[PyKDE] Qstring problem
Flávio Codeço Coelho
fccoelho at fiocruz.br
Tue Mar 1 13:44:41 GMT 2005
On Tuesday 01 March 2005 10:16, Hans-Peter Jansen wrote:
> Try e.g.:
> int(QLineEdit.text().latin1())
> or:
> int(str(QLineEdit.text()))
>
> In return it would be nice to time the variants and let us know the
> results.
Thanks Jorge and Hans,
and as requested by Hans, here are the timings:
Code:
from qt import *
a = QString('123')
for i in range (10000):
int(str(a))
In [4]: run -p teste.py
3 function calls in 0.020 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.020 0.020 0.020 0.020 teste.py:1(?)
0 0.000 0.000 profile:0(profiler)
1 0.000 0.000 0.020 0.020 <string>:1(?)
1 0.000 0.000 0.020 0.020 profile:0
(execfile(filename,prog_ns))
and for the latin1():
Code:
from qt import *
a = QString('123')
for i in range (10000):
int(a.latin1())
In [6]: run -p teste.py
3 function calls in 0.040 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.040 0.040 0.040 0.040 teste.py:1(?)
0 0.000 0.000 profile:0(profiler)
1 0.000 0.000 0.040 0.040 <string>:1(?)
1 0.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050301/2cd7dc66/attachment.bin
More information about the PyQt
mailing list