Markov Analysis Help
dave
squareswallower at 1ya2hoo3.net
Sat May 17 11:58:58 EDT 2008
On 2008-05-17 06:01:01 -0600, bearophileHUGS at lycos.com said:
> dave, few general comments to your code:
> - Instead of using a comment that explains the meaning of a function,
> add such things into docstrings.
> - Your names can be improved, instead of f you can use file_name or
> something like that, instead of convert_file you can use a name that
> denotes that the conversion is already done, etc.
> - You can use xrange instead of range and you can indent less, like 4
> spaces.
> - This line may be slow, you may want to find simpler ways to do the
> same thing:
> rkey = random.choice(analyze.keys())
> - I suggest you to add doctests to all your functions.
>
> Bye,
> bearophile
bear,
thanks for the suggestions. I use IDLE to write the code and when it's
working I paste it over into a new window. I'll tabify before saving
the pasted code. To add doctests would I need to use a certain
filename for the tests to be run on? Can you have doctests on random
functions?
Thanks
Dave
More information about the Python-list
mailing list