News for hackers. Stuff that matters.
Re:Ask HN: How do you handle large Python projects? by sitkack on Saturday May 28, 2016 @02:19PM (#11792674)
1) don't use objects, use bare methods and don't mutate input data

2) `from collections import namedtuple` reinforces 1

3) nice lighweight tests, py.test or nose

4) integration tests so you can actually refactor w/o having to recode 100 unit tests

5) write as little code as possible

Re:Ask HN: How do you handle large Python projects? by cdent on Saturday May 28, 2016 @02:56PM (#11792845)
+many to number 4. A super abundance of unit tests (especially if they use mocks) gives a false sense of security at the cost of high barriers to refactoring. Where's the win?
Re:Ask HN: How do you handle large Python projects? by mrfusion on Saturday May 28, 2016 @03:20PM (#11792985)
Any advice on writing integration tests?
Re:Ask HN: How do you handle large Python projects? by olau on Saturday May 28, 2016 @06:00PM (#11793761)
Write them in terms of user requirements. When someone does X, they expect Y to happen. If a test breaks, it should mean that a user somewhere would think there's a problem. See for instance this:

http://rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste....

You can write integration tests with the same tools as unit tests.

Personally, I try to make sure all major paths are covered, but I won't test every little UI detail. It's faster to test those manually. But YMMV.

Re:Ask HN: How do you handle large Python projects? by mrfusion on Saturday May 28, 2016 @03:17PM (#11792968)
Can you expand on 1 and 2?
Re:Ask HN: How do you handle large Python projects? by iampims on Saturday May 28, 2016 @04:31PM (#11793342)
Not OP.

2) From the doc [1]:

> Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index.

They do act as immutable containers for related data. They are usually used to replace classes that don't have any behavior/methods.

They avoid confusion by having a name, and named attributes.

[1] https://docs.python.org/2/library/collections.html#collectio...