4 ms·
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. S
by NotSammyHagar 7y ago
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.
- baq 7y ago1. forget python 2.7 exists 2. can't help with the whitespace, sorry; also take care handling Makefiles
- Erlich_Bachman 7y ago> 1. forget python 2.7 exists 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.
- protomikron 7y ago> 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.
- dr_zoidberg 7y agoExactly. 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).
- MaulingMonkey 7y agoMaya is still embedding Python 2.x. Soon (tm)... Makefiles are half the reason I enable visible whitespace in my editors.
- NotSammyHagar 7y agoI 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.
- yoloClin 7y agoI'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.
- XuMiao 7y agoPython does have a lot of problems, but it's so far the most flexible language like English. High level programming language is meant to communicate, not to dictate the computation. Python happens to be easy to understand by humans.
- cutler 7y agoRuby rates much higher on the Englishness scale.
- yoloClin 7y agoI 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.
- GordonS 7y agoHmm, 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.
- heinrich5991 7y agoUTF-8 is the current default.
- the_mitsuhiko 7y agoIt uses unicode but it doesn’t use UTF-8 by default as external encoding and never as internal encoding except for an optional secondary buffer.
- jwilk 7y agoWhat do you mean by "external encoding", "internal encoding", "secondary buffer"?
- bjoli 7y agoEncoding strings internally as UTF-8 is a bad idea, since you can't do efficient constant time access (utf-8 isn't fixed width).
- heinrich5991 7y agoEncoding 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.
- bjoli 7y agoAnd then you have to either re-train them to use string cursors or you have lots of people writing inefficient string code.
- heinrich5991 7y agoNot really, no. PyPy demonstrates that.
- BiteCode_dev 7y agoUnicode had been the default for 13 years. 2.7 reaches End of Life in less than 2 weeks. And as for curly braces, try typing: python -c "from __future__ import braces" In a terminal :)
- NotSammyHagar 7y agoThat wasn't what I expected. I thought it would say all is well! Funny.
- bakery2k 7y agoBraces 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?
- Luyt 7y agoWhen you write in a language which uses curly braces for statement grouping, do you indent your code? ...? I thought so.
- michaelcampbell 7y agoGenerally not; emacs or VSCode or IntelliJ or whatever does for me. Does for python, too.
- fxj 7y agoWith the new walrus operator you dont need indents anymore. You can write everything in one line in an array: e.g. y=0 for i in range(10): x=i+1 y=y+x*2 can be written as: [y:=0] + [[x:=i+1, y:y+x*2] for i in range(10)] The square brackets are the new curly brackets.
- joshuamorton 7y agoAs others mentioned, using lambdas this has been possible for ages. There's even a too to auto convert pre walrus code to a single line. It's just that no one does it.
- NotSammyHagar 7y agoThat 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.
- odiroot 7y agoThat would have literally made me never look into it in the first place. I would have went with Ruby instead.