If only it had curly braces instead of just indention. God, that kills me. And used unicode instead of ascii as the default. And there wasn't python 2.7 vs 3. Someone help me stop this list.
I've coded in python for >10 years and C# for ~half of that. I prefer indentation-based control flow purely because it condenses code vertically and creates consistent indentation with actual purpose (many of the devs on C# projects I've dealt with have had inconsistent tab/space settings and no linting).
If anything, the one thing I hate about Python3 is dynamic typing - inferring datatypes in function bodies is great but strongly typed (and _enforced_) parameters and return values would clean up a lot of the problems I have seen, and created in the past.
I don't disagree with anything you've said, but in my opinion strongly typed function definitions/returns are about communication rather than dictation - I'd rather the compiler tell me that I'm passing an unexpected argument type rather than the runtime executor.
But to contradict your point, there's also a fair amount of Python which is a dictation - Guido even called his job role 'Benevolent dictator for life'. I really hated some of the guidelines as a new programmer but after dealing with them for some time I understand that consistency is far more important than preference in many/most/all cases.
Hmm, I'm not really a fan of indentation based control flow, but I see the appeal of condensing code vertically.
I primarily work with C#, but I've gradually come to like the "K&R"/Javascript style (where the 1st brace is at the end of the first line), precisely because it helps condense code vertically.
I have worked at places where they insisted on 2 space indention, which made it much much harder to read the code and follow indention levels. It was just stupid of course. That's what really turned me off of python. I know there are bad formatting options for c style languages, and the editor should make it clear. but 2 spaces is too little, too late.
But it doesn't work this way. You don't work strictly with the language itself, you work with the whole ecosystem. Libraries, tools, snippets, SO questions, etc. And many of those are still in 2.7 or at least need to specify different solutions for 2.7... It is still a pain.
> Libraries, tools, snippets, SO questions, etc. And many of those are still in 2.7 or at least need to specify different solutions for 2.7... It is still a pain.
Admittedly there were some libraries that took a long time to switch, but at this point there is no serious library left, that did not make the switch.
Exactly. I've gone farther even, and this is my motto now:
Python 3.6+ or burn it to the ground
I mself still have to port a few projects yet, but those that got stuck in 2.7-3.5 land are en route to dying a fiery death, and being reborn in 3.6+ (3.8 where applicable, 3.6 as the lowest I'm willing to accept).
That is evil and wonderful. another reason to love/hate python. I'm working on a project for fun over the holidays and of course I wrote it in python 2.7, and it needs to process unicode so I inflicted double punishment on myself ;-)
My work project just happens to use python 2.7, causing pain for everyone.
Braces in Python would have issues, e.g. ambiguity with set/dict literals. Most similar languages (except JavaScript) seem to use begin/end instead. Would that be more acceptable than significant indentation?
Encoding strings internally as UTF-8 is a fine idea, usually you don't need constant-time access to individual code points. E.g. PyPy (faster Python, with JIT) does so. Many other languages also save strings as UTF-8.
Sure it does. Where CPython does byte inflation to make sure random access works, PyPy makes you use an extra indexing structure for cases where you can't just advance one char at a time.
I must say it is a rather elegant way, but it still fits firmly within "a new way or inefficient code".