3 ms·
django has 500K lines of python and it's considered well written and stable, so it's possible to do python with large code base I think. oddly, django does not
by synergy20 3y ago
django has 500K lines of python and it's considered well written and stable, so it's possible to do python with large code base I think. oddly, django does not seem to be even using type hints, new features such as dataclasses was not found from the source base either, still it just works well somehow.
- dsissitka 3y agoI was curious: SLOC Directory SLOC-by-Language (Sorted) 232099 tests python=232099 102470 django python=102470 424 docs python=424 158 scripts python=142,sh=16 21 top_dir python=21 0 extras (none) 0 js_tests (none) Totals grouped by language (dominant language first): python: 335156 (100.00%) sh: 16 (0.00%) Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
- deepsun 3y agoWow, 2.3x for tests/src ratio. I remember some recommendation for Java to have around 0.9x ratio, otherwise too much tests maintenance. Depends on the project of course, e.g. SQLite has an insane ratio.
- cies 3y agoCould also be that Java's typing already accounts for some part of what would need to be tests in Python code...
- deepsun 3y agoExactly, that's what I meant. E.g. if very_rare_condition: raise MyRareException Java wouldn't compile (no exception instantiation), but Python would work fine in production until the rare condition happened (but not captured above, as it's a class, not instance). Cases like that justify 100% tests coverage in Python, but not Java.
- simonw 3y agoThat's because a great deal of Django was written before type hints or even dataclasses existed.
- Hamuko 3y agoAnd type hints aren't really that mature yet. If you look at the `typing` module's documentation in Python 3.11, there's 23 occurrences of the string "Changed in version". And the Python 3.12 version of the same document adds 9 more. Type hinting in Python is constantly evolving.
- walthamstow 3y agoThat's the main reason we haven't adopted it at my place. We do have types of args and returns in docstrings though and it is enough for IDEs to do checks and suggestions from those types.