Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22464

"Morphex's Blogologue": A little sunday refactoring

$
0
0
Making a little progress in the ravencoin-taxman accounting script today, refactored date parsing into its own function in this commit:

https://github.com/morphex/ravencoin-taxman/commit/a6b8089cd...

There are some that might argue that a function (in any programming language) shouldn't take up more than one console window - if it's bigger than that it should be broken up.

I kind of agree, it's a good guiding principle. In this case, the function was reduced to less than half the size, and in the process, I guess you can say it become better documented as well, because the old function is easier to read and the new parse_date function also has a docstring with a little information.

Viewing all articles
Browse latest Browse all 22464

Trending Articles