4

First -- document your code! I read through your d_func function and here's my attempt at writing a docstring for what it does, with Python-2-compatible type hints. Hopefully I got it right. :) def d_func(digit, mode): # type: (Union[str, int], int) -> Union[int, str, None] """Mode 1: give the int value of the hex digit. Other modes: give ...


2

In addition to Sam I want to point out some other things Avoid typing long list/dict constants Very often you can construct them by code, which is less error prone. Instead of d_dict = {"0" : 0, "1" : 1, "2" : 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8, "9" : 9, "A" : 10, "B" : 11, "C" : 12, "D" : 13, "E" : 14, "F": 15} you do import string ...


2

Looking at your code, I can see two potential slowdowns: When you do a .count, Python is implicitly performing a for-loop over each element in the array. This scales horribly with bigger tables and is definitely causing a slowdown. The comment about returning a count would actually help a lot. Below, I've implemented a similar solution. Converting a list to ...


2

I don't have any experience with arcpy, so possibly some of this may be invalid. Mostly the code is very good: It's concise; it's clear enough what it does without lot's of documentation, and it has the documentation it needs. Exactly what makes code "good" depends on how it's going to be used. This looks like a standalone utility you use at your work, so ...


Only top voted, non community-wiki answers of a minimum length are eligible