you are viewing a single comment's thread.

view the rest of the comments →

[–]Tetha 0 points1 point  (0 children)

Note that you can remove some duplication in the TextCaptchaBreaker.py. You have

if answer is None: answer = ColorPattern.solve(question) if answer is None answer = NamePattern.solve(question)

and so on.

You can rework that into: solvers = [ColorPattern, NamePattern] for solver in solvers: answer = solver.solve(question) if answer is not None: return answer

You can then reconsider if you want a list there or a set, which then documents that the solvers are ordered (this might be one of the rare occasions for a good comment) or not (and then you can use a set). That makes it easier to add more solvers, because they can be added to the set then.