heap enhancements

DL Neil PythonList at DancesWithMice.info
Fri Jan 3 20:30:27 EST 2020


On 4/01/20 2:13 PM, rontoto wrote:
> Hi guys, the code is working, but I want know, what I can improve on this code. It is like implementation of the simulation of shipment clearance in the depot according to priority and available deliveries. How can I do it better? Can u show me? Thnx for your time.


1 add comments which document the code, explaining what each method 
accomplishes, etc

2 choose meaningful names - it is not like you're sending a telegram 
(and if you don't know what on earth I'm talking about, then this 
applies double!) and being charged by the letter.

Have you run any time-trials to establish whether the code is 'fast' or 
'slow'?

Recommended reading:
1 supporting the above, including PEP-8
2 supporting the above
3 writing program(me)s so that others can read them
4 search for "Python heap"
5 download and inspect heapq from the PSL (Python Standard Library)

There are algorithm-mavens on-list who might weigh-in at that level...
-- 
Regards =dn


More information about the Python-list mailing list