Thread: Auto-XYYXF tool
View Single Post
Old 2016-07-06, 04:01   #4
Basketry That Evening!
Dubslow's Avatar
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts

There are lots of things I could say about the code, both generically and Python specific... mostly, it's terse and uncommented, some variable names being rather opaque, though I think I was able to figure things out. Among other things, I would suggest that even for the most terse single character variables, you use them consistently -- sometimes you used p for factors, while later you used g instead of p for no particular reason I could see. Also, more spacing is always better (and see PEP 8 for the official Python spacing conventions, among other things). Finally, use Python 3. Python 2 is deprecated and has no advantages and several disadvantages compared to Python 3.

There are a variety of other things too, like unnecessary parens in conditionals and other things. See the attached for a full diff. (I more or less rewrote it line for line)

(And if you complain that this is a throwaway script, well... I used to do the same until I tried to read the throwaways when they became useful again after months or years of disuse... boy was that a pain. )

Edit: One of my more liked coans from among many:
Attached Files
File Type: txt (3.1 KB, 127 views)

Last fiddled with by Dubslow on 2016-07-06 at 04:17
Dubslow is offline   Reply With Quote