timely :: easy stopwatch interface in Python
Project description
Python Timely
=============
Stopwatch interface for Python. Currently supports two modes: timing execution (:class:`Stopwatch`), and pausing the completion of a block of code until a specified time has elapsed :class:`Blocker`.
Stopwatch usage
---------------
::
with Stopwatch() as s:
do_a()
do_b()
print s.duration() # time it took to execute do_a() and do_b()
do_c()
print s.duration() # time it took to execute do_a(), do_b(), and do_c()
if s > 3: # comparators implicitly evaluate duration
print 'took longer than 3 seconds'
Blocker usage
-------------
::
with Blocker(3) as w:
print 'Happens immediately!'
time.sleep(1.5) # executes immediately
# ... we wait here until 3 seconds have passed
print '3 seconds have passed!'
=============
Stopwatch interface for Python. Currently supports two modes: timing execution (:class:`Stopwatch`), and pausing the completion of a block of code until a specified time has elapsed :class:`Blocker`.
Stopwatch usage
---------------
::
with Stopwatch() as s:
do_a()
do_b()
print s.duration() # time it took to execute do_a() and do_b()
do_c()
print s.duration() # time it took to execute do_a(), do_b(), and do_c()
if s > 3: # comparators implicitly evaluate duration
print 'took longer than 3 seconds'
Blocker usage
-------------
::
with Blocker(3) as w:
print 'Happens immediately!'
time.sleep(1.5) # executes immediately
# ... we wait here until 3 seconds have passed
print '3 seconds have passed!'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timely-0.1.tar.gz
(2.4 kB
view details)
File details
Details for the file timely-0.1.tar.gz
.
File metadata
- Download URL: timely-0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 606ace9b90e083068255e47c5dcc44aca909bbc66edc4f54b82b2ec6e4a416e9 |
|
MD5 | e5f05e4780d32cf4bbd67c44b23dc627 |
|
BLAKE2b-256 | 31d747966f01701db2bf38324bef3e7d9202a55ffa9b23113d99353bfecc69d3 |