Guido van Rossum Explains How Python Makes Thinking in Code Easier (dropbox.com) 297
Dropbox's Work in Progress blog shared a 2000-word "conversation with the creator of the world's most popular programming language," noting that many computer science schools are switching over from Java to Python, and arguing that "JavaScript still owns the web, and Java runs 2.5 billion Android phones, but for general purpose programming and education, Python has become the default standard."
They also write that the language's recently-retired creator Guido van Rossum "thinks Python may be closer to our visual understanding of the structures that we are representing in code than other languages." "While I was researching my book, CODERS," says author Clive Thompson, "I talked to a lot of developers who absolutely love Python. Nearly all said something like 'Python is beautiful.' They loved its readability -- they found that it was far easier to glance at Python code and see its intent. Shorn of curly brackets, indented in elegant visual shelves, anything written in Python really looks like modern poetry." They also find that Python is fun to write, which is more important than it may seem. As Thompson writes, "When you meet a coder, you're meeting someone whose core daily experience is of unending failure and grinding frustration."
Building the priority of the programmer's time into the language has had a curious effect on the community that's grown around it. There's a social philosophy that flows out of Python in terms of the programmer's responsibility to write programs for other people. There's an implicit suggestion, very much supported by Van Rossum in the ways he talks and writes about Python, to take a little more time in order to make your code more interpretable to someone else in the future. Expressing your respect for others and their time through the quality of your work is an ethos that Van Rossum has stealthily propagated in the world. "You primarily write your code to communicate with other coders, and, to a lesser extent, to impose your will on the computer," he says...
Part of the enduring appeal of Python is the optimism and humility of starting over. "If you've invested much more time into writing and debugging code, you're much less eager to throw it all away and start over." Co-founder and CEO, Drew Houston wrote the first prototype of Dropbox in Python on a five-hour bus ride from Boston to New York. "The early prototypes of Dropbox were thrown away, largely, many times," says Van Rossum....
What has he taken away from his thirty year journey with Python? "I have learned that you can't do it alone, which is not an easy lesson for me. I've learned that you don't always get the outcome that you went for, but maybe the outcome you get is just as good, or better."
Though two decades ago van Rossum had tried a short-lived project called Computer Programming 4 Everybody (or CP4E), he now says "I'm not so sure that it needs to happen anymore. I think computers have made it to that point, where they're just a useful thing that not everybody needs to know what goes on inside."
Long-time Slashdot reader theodp also flagged van Rossum's remarks that "there are certain introductions to programming that are fun for kids to do, but they're not fun for all kids, and I don't think I would want to make it a mandatory part of the curriculum."
They also write that the language's recently-retired creator Guido van Rossum "thinks Python may be closer to our visual understanding of the structures that we are representing in code than other languages." "While I was researching my book, CODERS," says author Clive Thompson, "I talked to a lot of developers who absolutely love Python. Nearly all said something like 'Python is beautiful.' They loved its readability -- they found that it was far easier to glance at Python code and see its intent. Shorn of curly brackets, indented in elegant visual shelves, anything written in Python really looks like modern poetry." They also find that Python is fun to write, which is more important than it may seem. As Thompson writes, "When you meet a coder, you're meeting someone whose core daily experience is of unending failure and grinding frustration."
Building the priority of the programmer's time into the language has had a curious effect on the community that's grown around it. There's a social philosophy that flows out of Python in terms of the programmer's responsibility to write programs for other people. There's an implicit suggestion, very much supported by Van Rossum in the ways he talks and writes about Python, to take a little more time in order to make your code more interpretable to someone else in the future. Expressing your respect for others and their time through the quality of your work is an ethos that Van Rossum has stealthily propagated in the world. "You primarily write your code to communicate with other coders, and, to a lesser extent, to impose your will on the computer," he says...
Part of the enduring appeal of Python is the optimism and humility of starting over. "If you've invested much more time into writing and debugging code, you're much less eager to throw it all away and start over." Co-founder and CEO, Drew Houston wrote the first prototype of Dropbox in Python on a five-hour bus ride from Boston to New York. "The early prototypes of Dropbox were thrown away, largely, many times," says Van Rossum....
What has he taken away from his thirty year journey with Python? "I have learned that you can't do it alone, which is not an easy lesson for me. I've learned that you don't always get the outcome that you went for, but maybe the outcome you get is just as good, or better."
Though two decades ago van Rossum had tried a short-lived project called Computer Programming 4 Everybody (or CP4E), he now says "I'm not so sure that it needs to happen anymore. I think computers have made it to that point, where they're just a useful thing that not everybody needs to know what goes on inside."
Long-time Slashdot reader theodp also flagged van Rossum's remarks that "there are certain introductions to programming that are fun for kids to do, but they're not fun for all kids, and I don't think I would want to make it a mandatory part of the curriculum."
So, wait a minute... (Score:2)
but-
"
Ummm...
Re:So, wait a minute... (Score:4, Insightful)
Even if it were true, they're lauding making it more beautiful to them at the expense of making it more interpretable by software. When you C&P a code sample and destroy the formatting, and it no longer works, is that beautiful?
Re:So, wait a minute... (Score:5, Informative)
invisible characters mattering to code sucks. thing is, it's plenty easy to find coders who find python just abhorrent.
also the way that arrays etc work is nice for doing some operations on them but eh, saying that they are intuitive is just dishonest - and in general that you just kinda have to know what some variable is as you can't even tell it from looking at code that is using it if it's an array - a divide can be for every element or it can be for a single number.
# restore
cropped_vertices = np.reshape(cropped_pos, [-1, 3]).T
z = cropped_vertices[2,:].copy()/tform.params[0,0]
cropped_vertices[2,:] = 1
vertices = np.dot(np.linalg.inv(tform.params), cropped_vertices)
vertices = np.vstack((vertices[:2,:], z))
pos = np.reshape(vertices.T, [self.resolution_op, self.resolution_op, 3])
------------------
what I have noticed is that people who start with python stay with python and can't do _anything_ with any other language even if it would be a much better fit than trying to do everything with python. There's also a large segment of automated data processing research people (who keep insisting calling it AI for job purposes) who only use python and use only python bindings into libraries that are not written with python - then if you will try to find how said libraries are supposed to be used you will only stumble upon same copypasted python code over and over and over again.
There are worse things though - ever read an introduction to any ADA programming course/book ? you know that it's MILSPECCCCCCCC and superior for parallel programming to any other language.. at least according to the introductions that often go for pages and pages to justify the existence of the language(and the course/book will invariably just present you with basic equivalent programming).
Re: (Score:2)
Re: (Score:3)
>To me as a long time Matlab user anything that does not try to look like Matlab is not intuitive.
*Hold gun to your head* WHAT IS THE FIRST INDEX OF AN ARRAY?!
Re: (Score:3)
When you meet a coder, you're meeting someone whose core daily experience is of unending failure and grinding frustration
Coding is the easiest part of programming, and "trial and error" programming is just throwing shit at the wall to see what sticks. Design your crap before you write a single line of code. "Give me six hours to chop down a tree and I will spend the first four sharpening the axe."
When I first started programming, I had to work with a server admin in order to get some of my projects deployed. We went through the process and he told me every step of the deployment was to reduce and pre
theodp (Score:3)
Another anti-CS education screed by theodp. How predictable. Why doesn't he want kids to be taught CS?
Re: (Score:2)
Re: (Score:2)
if you ever want to have a seriously violent cry and can't quite get it out, read this codebase and have a think about what that quality implies: https://github.com/lammps/lamm... [github.com]
Re: (Score:2)
Re: (Score:2)
A lot of code in a lot of important places fails to meet your ideals quite badly.
Re: (Score:2)
Re: (Score:2)
Both are nothing but your assertions.
Re: (Score:2)
Er, are you saying only "special" people can fire up BASIC and write:
10 PRINT "YOU ARE AN ASS"
20 GOTO 10
Likewise anyone can paint a picture. We aren't talking about writing Linux here, just teaching kids basic programming.
Re: (Score:3)
Re:theodp (Score:5, Insightful)
You definitely don't. The fact that you want to cling to this idea that anyone can do it speaks directly to the fact that you know that really you aren't qualified and you don't want to admit that. Anyone who is qualified has worked with enough people who never will be no matter how hard they try to know the difference. To really drive the point home there are many people who can't get enough of a grasp on math skills to function as a cashier without having a register to tell them what the change should be. Your assertion that these same people are qualified to write software is beyond ridiculous.
Re: (Score:2, Offtopic)
Your assertion that these same people are qualified to write software is beyond ridiculous.
So what is your opinion on the team that wrote the "software", "analysis scripts" to develop the image of the first black hole? A large portion of their development stack was Python. [github.com]
What do you call what they did? Did they not write code in Python?
I would say they have much more math than you but in a *totally separate field of science*, astrophysics. And Python, and multiple high level libraries, made it a lot easier and faster to do their analysis. Those are people that wouldn't have learned C back in the
Re: (Score:2)
Re: (Score:3)
Re:theodp (Score:4, Insightful)
Re:theodp (Score:4, Informative)
I agree that most people should learn basic coding. I work with experimentalists that have only basic programming skills and that still allows them to massively improve their jobs. They will never be software developers but can still use programming to help their jobs. Exactly for the same reason as writing skills are useful even if you don't write a novel.
I think one of the best advances so far for most of these people are jupyter notebooks. You have a single place with the code, data and results and they can share the entire document with others that can execute it and when they run into trouble the document can be shared and debugged.
Re: theodp (Score:2)
Anybody can probably do theoretical physics or perhaps analytical chemistry. But they probably have as much success as a 2 year old with LEGO has of building a spacecraft.
Re: (Score:2)
You cannot compare PROGRAMMING A COMPUTER to succeeding at theoretical physics or analytical chemistry. Geez, how pretentious are you guys?
Re: (Score:2)
no, see... you can... IF the complexity of the task is equivalent to one of those tasks, and i can assure you that people use computers for those tasks and if you'd thought about it long enough you'd realise that was what you were saying even though it's pretty clearly not what you mean.
The conflation here is pretty obvious if you take a step back: people are unevenly reducing the meanings of terms in selective but opposed ways. You are not immune to that here bud.
Re: (Score:2)
That's it. Python is a bit on the barefoot side for my taste. Not nearly as bad and PHP and Node, but still bad.
Same applies to other languages (Score:5, Funny)
the english language is also beautiful when shorn of ugly punctuation
it reads like
poetry
imagine reading a whole novel
like this
Re: (Score:3)
Just another scripting language without static typ (Score:5, Insightful)
Maybe not as ugly as Perl or PHP.
Without static typing it is garbage. With static typing it is not much different from Java or C#, except that it does not compile down to machine code. The correct solution is type inference, which C# and even Java got right eventually.
The correct solution to {}s is the pre-C one -- end if or fi. That way you know things are matched up sensibly without needing and IDE.
Re: (Score:3)
And static typing should be at compile time, not run time. I want type errors without running the code. PHP only does run time static typing.
Re: (Score:3)
Interpreted code should have static typing done at compile time. Gotcha.
Re: (Score:2)
Early on, most of the errors I seemed to get were type mismatches where I had to go in and write enough code to force a proper type conversion.
It just makes more sense to me to force type declaration along with the variable itself.
Also We Note.... Visual Basic had that a long time ago, and found it to be much more of a problem tha
Re: Just another scripting language without static (Score:4, Informative)
Iâ(TM)ve used Python for over 10y and started using mypy this year on a large-ish project. The type annotation was a little weird at first and it still has ways to go but it is definitely helpful, especially with an IDE to help deal with a high number of custom classes and types that may have similar names and functionality.
Guido worked on mypy at DropBox and it took a few years for the typing to be solid enough for production development but we are now sold on it. Use an IDE that also understand type annotation and things are just much faster to code. I refer to the official docs to check the syntax a lot less than I used to.
If you are doing any serious work in Python you should use a modern IDE and make pylint + mypy part of your CI pipeline.
Re: (Score:2)
Static typing is completely incompatible with the way Pythons variables work. Variables are not boxes. They are names bound to objects. Furthermore, strong dynamic typing leads to the powerful concept of duck typing (similar but more flexible than polymorphism). If you're not using these features to your benefit then I suspect are will find (are finding) Python to be awkward and frustrating. In that case you're better off using a more appropriate language for your needs.
Many people have been using Python
Re:Just another scripting language without static (Score:5, Informative)
One advantage of brackets is that they have some redundancy, in a way: your code will have brackets to form code blocks, and will have indentation to visually set those blocks apart. If you somehow lose a curly, it'll be clear where it belongs thanks to the indentation. And (far more common) if the indentation gets messed up, your code will still work even though it'll look like crap, and restoring the formatting will be easy.
Re: (Score:2)
Re: (Score:2)
How does dynamic typing, specifically doing it in Python, help with this particular "worst kind of [error]?" I can see how unit testing and contracts could stop this sort of error (in any language). Just curious about the implication that dynamic typing might make things better in this case.
Re: (Score:3)
Well my experience shows that strong typing helps me find all sorts of errors at compile time that I wouldn't otherwise find until runtime.
A particularly bad problem is not having to declare variables at all such that mistyping a variable name doesn't flag an error but just creates a new variable. Strong typing helps avoid large classes of errors and also helps document the function. It really winds me up looking at a python function declaration to find out what I need to pass it and finding that it gives
Re:Just another scripting language without static (Score:5, Insightful)
+1000
On large Python code bases, the lack of static typing means you frequently have to crawl down through multiple layers to figure out what type the code is actually expecting.
If all you are doing is using Python for simple scripting, dynamic typing is fine and makes things easy. For production code on serious projects, it's one of Python's bigger drawbacks.
Re: (Score:2)
First of all if you are writing code without an IDE in 2019 you definitely shouldn't be writing code at all.
What kind of drooling knuckle dragger are you anyway? A skilled programmer does great work with or without an IDE. IDE's like to shit bogus files and bogus code all over the place. I would argue that the cleanest and best code is tends to be written with no IDE.
Re:Just another scripting language without static (Score:4, Funny)
" If your development environment doesn't do syntax highlighting you are not qualified to develop software. Period."
i'm sorry, WHAT!?
Re: (Score:3)
Have you ever considered ramming a hot poker up your nose? If not, you're really missing out...
(sigh) (Score:5, Insightful)
Shorn of curly brackets, indented in elegant visual shelves, anything written in Python really looks like modern poetry.
Oh, for frack's/frell's sake. Just about any code can be (or made to look) elegant or not -- including in Python.
What has he taken away from his thirty year journey with Python?
Please say, "I wish I had included support for brace-delimited block delimiters." [fingers crossed]
"I have learned that you can't do it alone, which is not an easy lesson for me. I've learned that you don't always get the outcome that you went for, but maybe the outcome you get is just as good, or better."
Damn.
Look, you can get all teary-eyed about Python, but it's just another tool that can be used and misused. There's almost nothing one can do in Python that can't be done in Perl and vice-versa -- or even in Java, but that's not a scripting language. I've been using Perl since way before Python was invented and, while I can read and debug Python -- like most programmers can with almost any language after some experience -- so-far, I haven't had any need to really learn it or code in it. I have it on my list of things to do, but I sincerely dislike white-space block delimiters.
Re: (Score:2)
here's almost nothing one can do in Python that can't be done in Perl and vice-versa
How are Perls machine learning libraries? Or numerical analytic? How narrow minded are you guys that *your* use case is the only usecase for code.
Re: (Score:2)
here's almost nothing one can do in Python that can't be done in Perl and vice-versa
How are Perls machine learning libraries? Or numerical analytic? How narrow minded are you guys that *your* use case is the only use case for code.
I feel you passion, but your statement doesn't disprove mine. Those libraries could be (re)written in Perl -- if they don't already exist somewhere. Both languages support enough similar features so problems that can be solved in one could be similarly solved in the other. So, be more careful before throwing around that "narrow-minded" thing ...
Re:(sigh) (Score:5, Informative)
If you think the whitespace thing is annoying, wait until you learn about some of the other fun things.
* Sometimes you have to pass an object to a function and sometimes you have to call a function on the object. For example, to find the first instance of a character in a string, you call "find()" on the string. But to find the length of a string, you call the global function "len()" with the string. That one took me a while to figure out when I first started with Python, as the str class documentation has information on many methods, but none of them returns the length of the string. Well, there is __len__(), but...
* Private methods on a class are denoted by starting with two underscores. But that's just a convention. You could easily call somestr.__len__() to get the length, which I did until I learned that it was supposed to be len(somestr). Which, AIUI, is implemented by calling __len__() on whatever object it is passed. There's probably some advantage to this, but I cannot see how it is better than just standardizing on classes having a len() method that people can call, which seems to be more in line with the whole duck typing idea. Maybe it's more historical than deliberate. Certainly Python wouldn't be the only language with historical baggage.
* I still haven't quite figured out how to correctly use import statements. Sure, simple ones are easy, but when should I use "import a.b.c" vs. "from a.b import c"? Is it just a preference, or is there a more substantive difference? And why does there have to be a file called "__init__.py" in each directory? There probably is a good reason, but it can be a real PITA, especially if you forget about it.
* Methods on classes in Python use a "self" variable to refer to the object. This is fine, and I guess it's fine that each class method has to take that as a parameter explicitly, but that variable also has to be used explicitly, whether setting variables or calling other class methods. An argument could be made that Python isn't really an OO language, but this really makes it obvious it isn't.
* Some of those cool packages come with some annoying drawbacks. At $EMPLOYER, we have a script that can do some processing using Tensorflow. It can do other things as well, but because it uses TF, it has to load it every time, even just to print the help statement, and that can take several seconds. Other imports, like matplotlib will fail to initialize and crash the script if DISPLAY isn't set, which is kind of annoying if the script is running from a cron job where there is no DISPLAY.
And this is just a stylistic complaint, but I find that Python style pushes a lot of underscores. Whether it is to mark something as "private", or to separate words in function names C style (i.e., "do_something"). Even though I mostly do C++ work, I've gotten more used to the more Java style "doSomething" camel casing. The C++ standard library is more C like, but many other libraries, as well as the large code base I work on at $EMPLOYER, tend to use camel case. But this is more a cultural thing than anything really technical. Kind of like braces vs. whitespace (though like most old-skool coders, I prefer braces as being more explicit).
This isn't to say that Python is all bad! It is really nice to be able to dump out a 2d array as an image through a nice package someone wrote. Just that no language is perfect, and it seems like lots of people look at Python through rosy glasses. I wonder if the people who wrote Numpy and some of the other more important Python libs had written them as Perl modules instead if Perl would be just as popular. Perl was really popular for a while mostly because of CGI.pm. Slashdot itself uses Perl because of that. Of course a lot of people consider the $@% decorations on variables to be "ugly" and very few people really understand regular expressions which seem more core to Perl than any other language, and between the two, Perl has a hard time overcoming the "line noise" reputation. So Perl is probably past its peak popularity.
Re: (Score:3)
I'm by no means a pro, but I've got to agree - Python is nice, but it's not short of weird foibles that catch you out.
You mention len() - that seems really weird to me, and that there isn't a builtin on list and string objects to do the same thing seems even more weird.
I also find joining a list into a string weird with ' '.join(my_list). That seems backwards, and although explained away in the docs, I'm left unconvinced the more usual mylist.join(' ') isn't easier to understand.
I'm also with you on the und
Utter Rubbish (Score:5, Insightful)
And the variable creation system is a nightmare for readability. When reading code, what type is variable y when y =someFunction(x)? Whatever the function it returned, and good luck digging down several layers of libraries, abstraction and logic to try to find out. You can't read code if you don't even know what type your variables are going to be.
Shorn of curly brackets, indented in elegant visual shelves, anything written in Python really looks like modern poetry.
This is a classic case of form over functionality and whoever said this has never had to read code in order to add features or debug it.
Hear, hear! (Score:2, Informative)
Wow, so if Python's says it's better, we are to believe it's better? Sounds like a cult.
Python's use of whitespace as delimiters is abhorrent.
Duck typing is just wrong.
Re: (Score:3)
Python allows annotations to document parameter and return types as well as variable types. Most other languages have some sort of auto typing system ("auto" in C++, "var" in C#) to behave more like Python. So these days you can do it either way in most languages. If you're writing bad code or working with people who don't document their code that's a problem regardless of language.
Re: (Score:2)
Maybe first all you curly bracket chauvinists should go off in a huddle, and get back to us when you've all agreed on ONE official bracket alignment style.
And yet, changing the alignment and/or indenting doesn't change the code's functionality. Not true with Python.
Re: (Score:3)
almost all of the statically typed languages have added support for inferring the type of y from the function, which may also be buried somewhere just as hard to find as any Python definition
Wrong. In statically typed languages, the return type of the function will be declared as part of the function declaration. You only ever have to search as far as the the declaration of someFunction() - this is usually trivially easy to do. With Python, you then have to look at the code, and if the code returns the result of some other deeper function, you are none the wiser.
You're not going to see many manual declarations of variable types anywhere going forward, because they're a both PITA to specify, and they pollute the source with a bunch of redundant line noise.
Having the return type of a function explicitly specified is not redundant line noise.
Re: (Score:3)
You only ever have to search as far as the the declaration of someFunction() -
That doesn't buy you anything. You still have to look at the documentation, just like Python.
The main convenience of having the return type declared is to help you manually type the redundant variable declaration for old-school statically typed languages without type inference. Beyond that, the function returns what it returns. If you don't do your research, up to and including looking at the code inside the function, you're pointing a loaded gun at your head.
Is the return value nullable? Is it mutable? Do
Forced indentation (Score:5, Insightful)
I like how forced indentation that has explicit meaning to the code is trumpeted as "beautiful", "readable", "poetry" when it really stems from implementing the simplest parser possible. They force these constraints on the developer due to limitations they built into the environment that interprets the language, then they make it sound like that's the greatest thing since sliced bread.
indented in elegant visual shelves, anything written in Python really looks like modern poetry.
I can't remember the last time I looked at code written in ANY structured language that wasn't indented in some meaningful and consistent way (code blocks and data structures indented with depth, etc). Heck, any modern IDE or even just source simple code editors handle the indentation automatically.
When you meet a coder, you're meeting someone whose core daily experience is of unending failure and grinding frustration.
What the hell? Really. What the hell? I'm sorry, but I very much enjoy my occupation, and to say the fruit of my work is "unending failure"... thanks for the insult, loser. And that comes from someone who maintains a complex app with both native iOS and Android source bases.
Maybe Python is so often used to create far lighter-weight things than native iOS or Android apps, or drivers, or mission critical code, that a developer feels a little more free and frivolous throwing together some scripts to do a little something here and there. Man, just the summary is so full of pomp and arrogance, I don't want to risk reading the article or I might be cleaning vomit off my keyboard tonight.
Re: (Score:2)
When you meet a coder, you're meeting someone whose core daily experience is of unending failure and grinding frustration.
What the hell? Really. What the hell?
Probably a Python programmer with a sticky Tab key ...
Re: (Score:2)
Heck, any modern IDE or even just source simple code editors handle the indentation automatically.
Except in Python. Strip all the leading white-space from Perl, C, Java, Ksh, etc... and an editor/IDE like Emacs, Eclipse, etc... can easily re-indent the code and have it be readable and functional. Not so with Python -- manual re-indenting required.
Never an issue. (Score:3)
How often do you ever do this or does this ever happen? Do you have computer gnomes that just go through and break your whitespace? What are you doing to your plain text files that whitespace just appears a disappears?
Your mythical 'but the whitespaces' is literally never an issue when writing Python for me.
Hundreds of times a day? (Score:2)
How often do you ever do this or does this ever happen?
As I type code I often hit re-indent in my editor to clean up the indentation - sometimes I'm deleting parts of blocks or moving code to a different block level, sometimes I just end up typing a bit off-indent by accident.
I've used a lot of different programming languages - including Python. Python was the singular language I simply could never like, precisely because you cannot clean up indents automatically and be able to visually verify code blockin
Re: (Score:2)
I like how forced indentation that has explicit meaning to the code is trumpeted as "beautiful", "readable", "poetry" when it really stems from implementing the simplest parser possible.
No, that's simply not the case. Implementing a parser that ignores whitespace and requires curly-braces (or whatever) is not significantly harder (or easier) than a parser that uses white-space for that purpose.
For better or worse, Python's white-space policy was based on how Guido wanted the language to work -- not on Guido's alleged inability to write a curly-brace-style parser.
Re: (Score:2)
For better or worse, Python's white-space policy was based on how Guido wanted the language to look
FTFY.
Other languages can be auto indendent (Score:4, Interesting)
python cannot be automatically beautified to your liking. Most other languages can be, making them inherently at least as readable if not more readable than python.
with python you don't usually know, without just "knowing", what a variable is.
also python has all the fun times of having different versions of the language that are incompatible - mostly python is just used in the same way shell scripts or bat files would be though. even more so than php is used.
this can be incredibly powerful of course - just like visual basic with excel can be incredibly powerful at handling data - but nowhere near as versatile as useful as applications or programs that are written with other languages that the python batch files then rely on to get anything done. this leads to that it being fairly unlikely that you would be using anything written with python on your daily desktop usage. it's far more likely that you use some service that is written in php even.
but like, come on, would you ask the creator of the parser why the thing it parses is beautiful? really? why?
Um, no. (Score:2)
"You primarily write your code to communicate with other coders, and, to a lesser extent, to impose your will on the computer,"
No, that's literature. The primary purpose for code is to have the computer perform some desired functions. A secondary goal is to also make that code readable / understandable for humans -- others *and* you (said as someone who returned to some code written years before and thought "WTF?" -- because if the code doesn't do anything useful, then it doesn't really matter how readable it is.
Re: (Score:2)
I think it's funny when I leave a comment /* drunk, fix later */
Re: (Score:2)
I think it's funny when I leave a comment /* drunk, fix later */
I was a grader in college back in the mid 80s and saw this in someone's semester OS class project -- simulating an interactive OS in C. Made me laugh.
unsigned int slice; /* a fruit-flavored soft drink */
Re: (Score:2)
What is Slashdot's Issue with Python? (Score:5, Insightful)
Not everything has to be bare metal C. Ignore politics, your stance on Python shows how "Old Men Yell At Clouds" most of you are. It's used daily in almost every science. There are well written libraries for everything from astronomy [astropy.org] to controls [readthedocs.io] to plotting [pydata.org]. Not to mention numpy and scipy.
Most 'hello worlds' into any sort of high level wrapper on machine learning is a few lines of code at most. Not everything *has* to be hard.
This isn't going to ruin what ever pedestal you put CS on but to teach engineers, scientists (in other domains), etc how to code. Get off your high horses about some purity test for what programming is to everyone. That's how science and discovery happens.
The picture of the blackhole, was made using Python [pythonlibrary.org] (Numpy, Scipy, Pandas, Jupyter, Matplotlib, & Astropy). NASA uses Python for data analysis. A lot of companies do. It's eating into the market spaces of Matlab, SAS, etc.
And yes, the fastest stuff is still written in C/FORTRAN. No one is arguing that.
No one is going to take your toys away. Perl5 still works. PHP will never die. COBAL programmers can still make great money. Rust has a long way to go to replacing C/C++ in Embedded. I just got an e-mail about Ada.
Try it, it's not that horrible.
Re: (Score:3)
Mostly very good points.
Try it, it's not that horrible.
I don't think anyone is arguing Python is "that* horrible, but it's not the "best thing since sliced bread" as Guido and his disciples proclaim. It's a tool; one with many useful features and libraries but also with one huge mistake (or, at least, bad idea) -- only supporting white-space block delimiters. It's completely unnecessary and causes some severe problems should leading white-space get lost/removed. And, again, it's *completely*, *totally* unnecessary. Also, for the most
Re: (Score:2)
Also, for the most part, if one knows Perl, there's no need to learn Python
Is someone out there doing a lot of machine learning these days for Perl? How are Perl's astronomy libraries? Equivalent of Pandas? Maybe in the space that Perl is operating it it's not competitive to switch. But Perl does not have the same ecosystem.
You keep going on about the available libraries and use cases for Python and I grant you those points, but the main article was about the language and libraries aren't that. Those libraries *could* be (re)written in Perl (or Java) and the languages share enough features and constructs so that things written in Python could be implemented in them. From a coding standpoint, what can done in Perl can be done in Python (and vice-versa) and knowing one language means you don't *need* to know the other. From a
Re: (Score:2)
The GP is just argumentative. If this article was about an interview with Larry Wall, this twit would be making Perl out to be the best thing ever.
Re: (Score:3)
What is your normal use case for 'coding'? It might be horrible for what *you do*. What *you do* is not what *other people* do.
Re: (Score:3)
I'm legitimately asking what you do what Python doesn't work for you. There are *a lot* of programmers that have no issue with using it for *their use cases*.
I'll switch to your language of choice, what is it? Can you point out the equivalent toolboxes to numpy, scipy, seaborn, matplotlib and pandas? That's all I really use.
What is with slashdot's no true scotsmen of what programming is and isn't? What do *you people* do every single day that this isn't your tool?
Python is a mess IMHO (Score:2)
Re: (Score:3)
I used to really hate Python's regex, I had gotten used to Perl's inline regex and just thought that's how the world should work. Then I spent some time to actually understand how Python did things and my opinion completely reversed.
Python strings are objects rather than just an array of bytes in drag. They have a lot of really useful built-in methods that handle the simple transformations you might do with a regex in Perl. The RE module is also very expressive with a lot of helper methods and returns objec
Re: (Score:2)
"foobar".match(/foo/)
[1,2,3].map(n => n + 1)
The equivalent of these in Python is a nightmare.
Re: (Score:2)
What if we *never use Regex*? Who cares how good a regex module is if it's never in our use cases?
How is Perl's numerical analytic library? Machine learning libraries?
Re: (Score:2)
He is probably parsing log files for this job. That typically is map/reduce + regex.
Re: (Score:2)
Re: (Score:2)
Yet people still use Astropy. People are actively developing it. People are using it for stuff like making pictures of black holes. So *someone* wants to use it. If their use case isn't the same as yours what is all of Slashdot's issue?
Re: (Score:2)
Re: (Score:2)
The "beauty" is that in one or two lines I can do complex astronomy. Not slugging through C or FORTRAN like they did in the 70s.
Re: (Score:2)
The "beauty" is that in one or two lines I can do complex astronomy. Not slugging through C or FORTRAN like they did in the 70s.
Reminder: That "beauty" could be (re)implemented in other languages. Python just had/has them first/now. The language and the libraries and supporting infrastructure are different things.
Also note that FORTRAN is *still* used for a lot of things because it's fucking fast. Some of that is because it's been around so long and has been optimized a lot and some of that has to do with the way the language implements / represents things, like arrays, at the machine level. For example, I compared two function
Re: (Score:2)
I could do the same in any language that had the library provided for me. Now, what language is the library written in?
Re: (Score:2)
Re: (Score:2)
Lots of people fire guns into their heads. I notice you haven't tried it.
Good Grief (Score:2)
...[Python creator] Guido van Rossum "thinks Python may be closer to our visual understanding of the structures that we are representing in code than other languages.
Well, what in the world would you expect him to say? He created Python to express how he thinks of coding. Why is it a surprise that Python represents how he thinks of coding?
Re: (Score:2)
...[Python creator] Guido van Rossum "thinks Python may be closer to our visual understanding of the structures that we are representing in code than other languages.
Well, what in the world would you expect him to say? He created Python to express how he thinks of coding. Why is it a surprise that Python represents how he thinks of coding?
Wonder how he thinks about other things? Does he have bookends on his shelves or are things falling off the ends all the time. :-)
Re: (Score:2)
Obvious (Score:2)
A language creator is obviously going to think the language he wrote is the best one, he designed it reflect what he thinks. Others will obvious think differently, the most impartial judges are developers that have not written their own language because one exists that fits their needs.
Re: (Score:2)
Based on popularity, Python is a very good language - it's number three and growing rapidly. https://stackify.com/popular-p... [stackify.com] behind only Java (shrinking slowly) and C (growing slowly), and well ahead of number 4 (C++, shrinking rapidly). I use many different languages to solve many different problems, and Python is particularly easy to teach/learn and has amazing libraries that make it very easy to use in many domains (e.g. NumPy). So it's displacing more specialized languages (e.g. R).
English and Math (Score:2)
I think we should only teach English, Drawing (not art), and Math (up to multivariable calculus, number theory, and linear algebra), and nothing else, until high school.
With those skills, you can learn other stuff in high school .. it will make more sense.
Re: (Score:2)
Or you can learn stuff earlier and then reach more advanced levels at at earlier age.
Makes HIM (Score:2)
Re: (Score:2)
Most developers have an inflated view of themselves, because they are getting paid so much.
Re: (Score:3)
found the Holy Grail
<French_Accent>We already got one!</French_Accent>
Say what? (Score:2)
What the hell is he talking about? 99.99999% of computer code I have written has never nor will it ever be seen by another programmer. The point it to *make the computer compute things", I am no
Types. Types are the missing. (Score:4, Insightful)
Look, it's all very well to talk about how easy Python is, but it doesn't matter. What actually matters is how good a language is at expressing what you want the computer to do for you. We talk a lot about programming ideals, things like the SOLID principles, and Onion/Hexagonal architecture. But one of the things that's not talked about nearly enough is Category Theory, and Type Arrows. If you can't reason about what goes into a function, and what comes out of a function, then you don't have a complete way to express what you're programming about. If you can't write functions that work in an asynchronous way that are without side-effects and closures then you're going to get yourself in trouble. This pretty much rules out both Javascript and Python as complete languages. They maybe easy to work with, but they are incomplete at expressing intent, and therefore going to cause you heartache.
Re: (Score:3, Interesting)
> What strawmen will you build next for why Python sucks? None of that ever comes up.
That was an ironic strawman about strawmanning. Since you're too simple to type "python sucks" into google, you're just trolling. That being said....
Lambdas are not a good replacement for first class functions, crippling the language...but at least you can run a 1 line map()...
Python has lest the sane syntax behind (the lambda keyword is IN the map, wtf?). Interpolation uses an weird little f now, shuffle in place vs cop
curriculum (Score:2)
Sorry Guido, too late, it's a requirement in Australia.
They make the jocks learn to code too, character building, like wearing pink.
There's a reason why Python ... (Score:2)
... is the only programming language that is used professionally in *every* field. Python is the modern days true general purpose language, and an easy and fun one to learn at that.
Aside perhaps from some newfangled avantgarde purely functional language that enforces functional programming more strictly or has a better control and handling of concurrency I would consider Python the go to language for just about anybody and any problem aside from perhaps preheating highly specialised systems such as spacecra
Python has its share of warts (Score:3)
Re: (Score:2)
There's a reason he had project lead status unceremoniously taken away from him.
I don't care whether you like or don't like Python, but please make sure you get your facts correct.
Guido was the Benevolent Dictator for Life and would have remained as such for as long as he chose to do so.
His reasons for stepping down are well documented:
https://lwn.net/Articles/75965... [lwn.net]