Thanks for all the replies,
I got this code from a protocol spec that I must use for communications to a
RS232 interface and this the way they calculate the CRC for the data in the
packet.
I have never done any C programming and thought that somebody in this list
may be able to assist.
The idea
Hi Chris,
that seems to be exactly what i need.
Cheers
Kim
>>> import resource
>>> def cpu_time():
... return resource.getrusage(resource.RUSAGE_SELF)[0]
...
Now try this out
>>> def f():
... for i in xrange(10):
... pass
...
>>> start = cpu_time(); f(); dt = cpu_time() - start; pri
This link may be of use to you. http://www.gossamer-threads.com/lists/
python/python/545797?page=last
-Chris
On Feb 6, 2007, at 9:37 PM, Kim Branson wrote:
>
> The time in used by the cpu for the execution of the script, rather
> than the wall clock time.
>
> CPU execution time for program =
On Feb 6, 2007, at 9:37 PM, Kim Branson wrote:
>
> On Feb 6, 2007, at 8:20 PM, Christopher Lucas wrote:
>
>>
>> On Feb 6, 2007, at 9:14 PM, Kim Branson wrote:
>>
>>> Hi
>>>
>>> whats the simplest cross platform way of getting the cpu time
>>> used by
>>> a python script?
>>>
>>> Kim
>>
>> What
The time in used by the cpu for the execution of the script, rather
than the wall clock time.
CPU execution time for program = Clock Cycles for program x Clock
Cycle Time
But i'm interested in the cpu cycles used purely for the python app,
regardless of what other processes may be running.
On Feb 6, 2007, at 9:14 PM, Kim Branson wrote:
> Hi
>
> whats the simplest cross platform way of getting the cpu time used by
> a python script?
>
> Kim
What do you mean by cpu time, Kim?
-Chris
___
Tutor maillist - Tutor@python.org
http://mail.pyth
Hi
whats the simplest cross platform way of getting the cpu time used by
a python script?
Kim
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi Danny,
>
>
> Hi Tony,
>
> Ack!
>
> This is not safe. I would strongly recommend not to do this. There is a
> much simpler way for the caller to be written:
What is not safe about doing it this way ?
>
> import tester
> tester.main([], "argument")
> #
On Tue, 6 Feb 2007, Daniel Yoo wrote:
>> this is the callee which is saved in tester.py
>> ##
>> import sys
>>
>> def main(arg):
>> if arg != []:
>> print"\nArgument is %s" % arg
>>
>> if __name__ == "__main__"":
>> main(sys.argv)
>> #
On Tue, 6 Feb 2007, Tony Cappellini wrote:
> this is the caller
> ##
> callee=open("tester.py").read()
> exec(callee)
> eval("main(['', 'argument'])")
>
> ##
> this is the callee which is saved in tester.py
> ##
I saw a snippet of python which is used to execute another python
script, and I'm trying to understand the mechanism. Simple as it is, I
don't understand how it works :-)
this is the caller
##
callee=open("tester.py").read()
exec(callee)
eval("main(['', 'argument'])")
On Tue, 6 Feb 2007, Kent Johnson wrote:
> Well, the options seem to be
> - take Martin L. Lowis up on his review 5 / get 1 reviewed offer
> - beg on python-dev
> - beg privately to a committer of your choice
> - become a committer and fix it yourself ;-)
Well, I don't have the development skills
On Mon, 5 Feb 2007, Terry Carroll wrote:
> On Sun, 4 Feb 2007, [ISO-8859-1] Magnus Wirstr?m wrote:
>
> > I'm workinga on a program that will upload a large file to a server
> > using ftp. I'm using ftplib to do this. I'm using a gui with wxpython
> > and i would like to have a progressbar showi
Terry Carroll wrote:
> On Tue, 6 Feb 2007, Kent Johnson wrote:
>
>> Bottom line: the committers are volunteers and they work on what they
>> want to. Often they prefer writing code to reviewing and applying patches.
>
> I wonder if there's any way to wave this one under their nose. If for no
>
Terry Carroll wrote:
> On Tue, 6 Feb 2007, Kent Johnson wrote:
>
>> Kent Johnson wrote:
>>> This page has more details:
>>> file:///C:/Python25/Doc/lib/doctest-finding-examples.html
>> Oops. The on-line version of that is here:
>> file:///C:/Python25/Doc/lib/doctest-finding-examples.html
>
> http
On Tue, 6 Feb 2007, Kent Johnson wrote:
> Kent Johnson wrote:
> > This page has more details:
> > file:///C:/Python25/Doc/lib/doctest-finding-examples.html
>
> Oops. The on-line version of that is here:
> file:///C:/Python25/Doc/lib/doctest-finding-examples.html
http://www.python.org/doc/lib/doc
On Tue, 6 Feb 2007, Kent Johnson wrote:
> Bottom line: the committers are volunteers and they work on what they
> want to. Often they prefer writing code to reviewing and applying patches.
I wonder if there's any way to wave this one under their nose. If for no
reason other than to stem potent
Kent Johnson wrote:
> This page has more details:
> file:///C:/Python25/Doc/lib/doctest-finding-examples.html
Oops. The on-line version of that is here:
file:///C:/Python25/Doc/lib/doctest-finding-examples.html
Kent
___
Tutor maillist - Tutor@python.
on for a solution.
>
> Chris
>
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
> __ NOD32 2040 (20070206) Information __
>
Vladimir Strycek schrieb:
> Hi all,
>
> Is it possible to do self modifing script ? I think like variables which
> are defined in the beginning of script could be modified by it self on
> the run... like saving setting but not to external file but directly to
> it self...
While what you propos
Don Taylor wrote:
> When I try to use something like:
>
> >>> hexStringNums = ('1', '2', '3', '4', '5', '6',\
> ... '7', '8', '9','0')
>
> or:
>
> >>> for hexString in hexStrings:
> ... for x in hexString:
> ... if ((not x in hexStringChars) and
> ... (
Hi all,
Is it possible to do self modifing script ? I think like variables which
are defined in the beginning of script could be modified by it self on
the run... like saving setting but not to external file but directly to
it self...
Thanks and best regards
Vladimir
_
On Tue, Feb 06, 2007 at 12:10:36PM -0500, Chris Calloway wrote:
> First, you need to find the preprocessor define for CCITT_POLY. The code
> is incomplete without it.
>
> Second, where did this code come from? It defines an unused local named
> cval, which will usually cause at least a compilati
When I try to use something like:
>>> hexStringNums = ('1', '2', '3', '4', '5', '6',\
... '7', '8', '9','0')
or:
>>> for hexString in hexStrings:
... for x in hexString:
... if ((not x in hexStringChars) and
... (not x in hexStringNums)):
...
First, you need to find the preprocessor define for CCITT_POLY. The code
is incomplete without it.
Second, where did this code come from? It defines an unused local named
cval, which will usually cause at least a compilation warning.
This looks like a snippet, not a complete CCITT CRC calculati
On Tue, 6 Feb 2007, Johan Geldenhuys wrote:
> I'm not a C++ expert at all and I would like to find out if somebody can
> explain to me how the statement below can be done in Python?
>
> """
> _uint16 ComCRC16(_uint8 val, _uint16 crc)
> {
>_uint8 i;
>_uint16 cval;
>
>for (i=0
Johan Geldenhuys wrote:
> Hi all,
>
> I'm not a C++ expert at all and I would like to find out if somebody can
> explain to me how the statement below can be done in Python?
I suggest you Google "Python CRC" and find out how others have done
this, rather than trying to translate the code direc
Hi all,
I'm not a C++ expert at all and I would like to find out if somebody can
explain to me how the statement below can be done in Python?
"""
_uint16 ComCRC16(_uint8 val, _uint16 crc)
{
_uint8 i;
_uint16 cval;
for (i=0;i<8;i++)
{
if (((crc & 0x0001)^(val &
Steve Nelson wrote:
> On 2/5/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>> You can also do this operation easily with dicts (not tested!):
>
> Thank you - code now complete and tests passing. Would appreciate
> comments / criticisms. I did wonder if I should create a UrlAnalyser
> Class rather
Alan Gauld wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>
>> Because of the ambiguities of month arithmetic (what is 2005-1-31
>> plus
>> one month?) datetime refuses to guess and does not support this.
>
>> The third-party dateutil module is not as circumspect:
>>
>> In [1]: import datetim
Terry Carroll wrote:
> The hard part is going to get ftplib to talk to your dialog. You're
> uploading. ftplib's download methods (retrbinary and retrlines) include a
> callback option, which would let you update the progress as you went, but
> the upload methods (storbinary and storlines) doe
"Kent Johnson" <[EMAIL PROTECTED]> wrote
> Because of the ambiguities of month arithmetic (what is 2005-1-31
> plus
> one month?) datetime refuses to guess and does not support this.
> The third-party dateutil module is not as circumspect:
>
> In [1]: import datetime
>
> In [2]: startdate = date
"Andrew Purdea" <[EMAIL PROTECTED]> wrote
> Hi! what do you guys think that would be the best free book, or
> tutorial or
> something to start learning python?
The best free book for an experienced programmer is the
standard tutorial that comes with Python.
> Something that can also focus on i
On 2/5/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
> You can also do this operation easily with dicts (not tested!):
Thank you - code now complete and tests passing. Would appreciate
comments / criticisms. I did wonder if I should create a UrlAnalyser
Class rather than have hanging methods:
#!/
34 matches
Mail list logo