codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

heap enhancements


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