Re: Index format v5
From: Thomas Rast <hidden>
Date: 2016-06-15 22:53:50
Michael Haggerty [off-list ref] writes: First of all, many thanks for taking up this time-consuming job while I was away! There's not much I can add at this point, just a few minor points:
9. read_files() doesn't need to return "entries". Since entries is an array that is only mutated in place, the return value will always be the same as the "entries" argument (albeit fuller).
(Ab)using an array in this fashion is somewhat iffy. It seems unavoidable in this case (while still retaining the runtime), but try not to do it too often, and perhaps name the parameter something that makes this clear (such as 'out'). Usually changing it to use a generator function (with 'yield') helps.
11. It is good form to move the file-level code into a main() function, then call that from the bottom of the file, something like this:quoted
def main(args): .... main(sys.argv[1:])
It's customary to wrap it as
if __name__ == '__main__':
main(sys.argv[1:])
That way your script becomes 'import'-able, which can be handy (if only
for testing).
Cheers,
Thomas
--
Thomas Rast
trast@{inf,student}.ethz.ch