3 ms·
Tools that enforce "expert level" coding standards do make code more concise, but also less comprehendible for the less experienced developers. I never saw the
by SkipperCat 5y ago
Tools that enforce "expert level" coding standards do make code more concise, but also less comprehendible for the less experienced developers. I never saw the harm in four lines of code instead of one, especially when it's much more readable.
- makeitdouble 5y agoI am not a fan of the examples in the article, but for tools like rubocop in ruby, I am pretty glad it sometimes uses semi-obscure but more "correct" forms. When I started learning ruby a bunch of the changes flew over my head, but it is also an excellent entry point to look further into best practices, and concrete examples of how my code could be better. The condition is of course the tool being itself extremely good, otherwise it's just everyday hell (looking at you, phpstan...)
- 29athrowaway 5y agoPython is a sane language that you can master in a reasonable amount of time. If you think expecting people to achieve Python mastery is unreasonable, wait until I tell you about language called C++.
- SkipperCat 5y agoAgreed, but I work with a lot of sysadmins who will never master Python. They'll use it, but never be at the level of a software developer. And that's OK because they have tons of other skills which are super valuable. I'd rather have our monitor scripts and glue code be more readable than complex. I would never demand this for someone writing a Python app or module that out team would use as a normal import, just the stuff we actively manage.
- PeterisP 5y agoI agree with the general concept of "Tools that enforce "expert level" coding standards do make code more concise, but also less comprehendible for the less experienced developers." but this does not seem applicable here - it's not "expert level" coding, the suggested method is obviously readable to anyone who writes Python and is something that a programmer who has never used Python would learn in their first day of learning Python, it's not an advanced concept. Probably the whole concept of idiomatic Python is that there shouldn't be different styles of Python to which you graduate according to skill or experience, but rather that the simple, readable way of writing things should be done by everyone, always, from novices to experts. Code-golfing with dense weirdness would be "anti-Pythonic" but this ternary expression would be readable even for if someone who's never seen Python would read it as pseudocode in some theoretical CS paper.
- notatoad 5y agoin general i agree, but i'm not sure what you're referring to as "expert level" here - if it's ternary operations, those a pretty basic concept, and i don't think there's a clear argument to be made that they're more or less readable than expanding out the if statements, it mostly just comes down to preference.