The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
With a right editor you can make them visible.
...my code vs.
-> my code.
But that creates a lot of noise on your screen and doesn't contribute to readability.
Even better, an editor that always converts tabs to spaces, which I think VS does too (or at least it's a setting).
Everyone on the team should always use the same amount of spaces for all projects though.
Not having that is annoying in C#, but probably disastrous in Python (or Haskell).
All in all, I don't think it has to be a problem.
I've been doing some YAML lately and I couldn't even get it to break because my (web) editor just wouldn't allow it.
If the code is properly formatted and the spaces are invisible I think it looks pretty and concise though.
If you use a Python aware editor you probably don't need to care. I use IDLE (the Python IDE), and Visual Studio Code. Both of them handle the indentation perfectly so it is not much of an issue. Until you want to reformat the file in a different editor.
Having to use a language aware editor so that it doesn't actually destroy your code is a huge red flag in terms of language design, IMO.
Significant whitespace has no place in language grammars. It's poor design. The proof is in the confusion and other problems it generates, like literally invisible syntax/"compilation" errors in source code.
The thing that keeps me away from it is the significant whitespace in the grammar** and my general distaste for scripting. I know both of those things are just me being nit picky but we all have our preferences.
I agree, though I did get used to the significant whitespace in F#, and other FP languages use that as well, which of course leads to the problem Sander described.
As to scripting, I comfort myself in that any of the heavy lifting is done behind the scenes in C, so the way I think about it is, all Python really is is a more sophisticated language (as compared to say, a .bat file) for gluing together calls to compiled code.
Like any scripting language, I find that it requires its own unique discipline to write decent code - many disciplines are the same, like DRY, but each language has its own unique set of "best practice" disciplines, and Python is no exception.
all true. my main issues with scripting are these:
1. Usually because of duck typing and lack of full compilation and such errors can be harder to track down.
2. In terms of performance it is so often hard to know exactly what is going to cause the performance issues, or worse, sometimes there isn't a reasonable way around it. That's fine, when scripting is used here and there in moderation, but it's a different story when you're powering an entire application with it.
I find Python's type hints to be very useful in my own code.
As you mentioned, they aren't checked when Python compiles your source into bytecode. But good tooling catches errors pretty quickly. Pycharm does a good job of screaming at me if I do anything that violates my type-annotated Python code.
As for performance, it depends on what you're doing. Most of Instagram's UI is still data from a Django app, so big Python apps running at massive scale can work if you're careful. Might not work as well for other types of applications, though.
Usually because of duck typing and lack of full compilation and such errors can be harder to track down.
Oi, that is definitely the worst thing. I wrote a complicated application to run on an rPi that dealt with hardware inputs and outputs, various configurations, etc., and it was painful, and I mean PAINFUL, to run the program only to discover I had some stupid typo.
PyLint helped a lot! As did mocking the classes that did the hardware interface (with a UI written in GTK, yuck), and running the thing on my PC first. Which was awesome, being able to test and debug on Windows before shuffling the code over to the rPi!
I've browsed github python repositories and found much more than that therein. I think your workmate maybe didn't give you the best example. Unfortunately I don't have a better one handy, as my level of involvement in all of this is as a passing interest.
"All these cool things you could do with Python" is very rarely because of the language itself, but due to the ecosystem built around it. A similar ecosystem built around any other language or platform would be just as cool ... in principle. From a technical viewpoint.
But the psychology of identity is super-essential here. A Python package is for us, we the Python community. Let those C++ and C# and VB and Fortran guys do their own, if they like - that's none of our business.
We could try to build a similar ecosystem around dotNET, with the same spirit surrounding an assembly well rivaling PyPi in size and variation, available to all dotNET languages. But what sort of identity and unifying community is that? I think it is far from realistic creating anything close to the same enthusiasm around dotNET, without that focusing point that is The One Unifying Language that we all speak in our code.
There is nothing in the Python language as such that makes it more suitable. What is does or does not offer in programming mechanisms isn't essential. But its function as a beacon to lead you into safe waters of a cool ecosystem is.
imho, this is elegantly said, and points to the social context changing as more and more computational and graphic power are available, affordable.
Narratives, often mythic, form around computer languages qua social movements. With Python, I have wondered if the "sole author" origin has added an aura of "for the rest of us" ... of individuality vs conformity.
The mythos that Steve Jobs was such a conscious creator and performer of ... his "reality distortion field" ... term first used by Bud Tribble at Apple Computer in 1981 to describe Jobs.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
It gives the users the power to say "We rule! We don't give an elephant about anyone else - we are in our own world were WE are masters, doing things OUR way! We give you POWER!"
Forget about interfacing to other languages. Forget about common libraries for arbitrary languages. Forget about other ways of distributed updated software. Established ways of installing software. We do everything The Python Way!
That feeling of power, independence from any non-Python dictate, is quite essential. Python people feel that they are masters of the world. That is, their closed Python world. And that is enough for a whole lot of them.
That explains the mid-life crises feeling I have this year. I did not know it was cyclical.
What a bummer.
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone