5

Data safety Your current HTML_search_attributes is type-unsafe - it's closer to a serialized format than an in-memory format. Consider moving those data to a .json file. Deserializing it will give you exactly what you have now, though I recommend going one step further. Make a class or at least a named tuple to represent a scraped domain, with attributes ...


3

You are unfairly doing more work in the function approach! Product = namedtuple('Product', ['domain', 'name', 'price']) creates a new type every time the statement is executed. Consider: result1.__class__ == result2.__class__ That will evaluate as False, for different result objects, even when returning results from the same site! You should move the ...


2

Yours is definitely an improvement, but there is still room for more improvement: PEP8 The official Python style guide will tell you: two newlines between every function (i.e. before detectCollision, etc.) function and variable names in snake_case, i.e. detect_collision avoid line continuation: this return cat.get_size()[0] + x >= window_size[0] ...


2

From @pepijno 's answer: What I've seen the most when it comes to builder patterns is that the object (in your case Animal) will get constructed in the build method of the builder. It is preferred to create instances of objects with all the data that the object should have, eg not creating invalid states of an object. That is true. However his following ...


2

What I've seen the most when it comes to builder patterns is that the object (in your case Animal) will get constructed in the build method of the builder. It is preferred to create instances of objects with all the data that the object should have, eg not creating invalid states of an object. This prevents you from having illegal state in your program which ...


2

I'm writing a bash script to search C source files and find the lines where I missed the void keyword This alone suggests that your approach is very problematic. To do this properly you'd effectively need to write most of a C parser, and that isn't a good use of your time. There are other approaches that would get you more mileage and accuracy: Double-...


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