News for hackers. Stuff that matters.
Re:Why Is Python Growing So Quickly? by rpazyaquian on Thursday September 14, 2017 @12:37PM (#15249682)
You're listing off tooling, libraries, and frameworks written with or targeting Python, which isn't Python itself. As soon as you want to go off the rails in any of those things, Python gets as complicated as any other language.

My take on the matter is that Python is gaining traction due to its market share of the Data Science/Machine Learning field, which is what's really gaining traction and growing quickly. Had Perl or Ruby been the premier language to use for DS/ML, they would be growing instead of Python.

Re:Why Is Python Growing So Quickly? by andrewflnr on Thursday September 14, 2017 @12:52PM (#15249879)
Come on, we all know a language and its library ecosystem go hand in hand. Trying to separate them from the standpoint of adoption is pointless. TFA comes to its conclusion by looking at libraries. In your hypothetical where Perl or Ruby take Python's place, that would manifest as Perl or Ruby having better data science libraries. The causality would probably be just as cyclical as it is for any "best language/library for task X" question.
Re:Why Is Python Growing So Quickly? by schneems on Thursday September 14, 2017 @12:46PM (#15249803)
This. Most schools are moving away from C or Java being their primary language. Most comp sci professors acknowledge the usefulness of a scripting language and so when they need to pick one, they pick one they have the most familiarity with. Due to numpy and scipy this tends to be Python over Ruby.

Also many things about python that I don't like such as `len` being a function rather than a method on a list are very trivial when coming from a language like C which has hordes of tiny inconsistencies.

The whitespace thing in python is pretty gimmicky but does also hold a certain amount of pedantic appeal.

Re:Why Is Python Growing So Quickly? by xapata on Thursday September 14, 2017 @01:41PM (#15250432)
The Python design FAQ explains why Len is a built-in function instead of a method. Guido wanted a guarantee that whenever he called it, it'd return a whole number. As just another method, you might find a new type that defines a length in fractional terms, which would break any code wanting to use that as a list index, etc.
Re:Why Is Python Growing So Quickly? by goatlover on Thursday September 14, 2017 @02:42PM (#15251126)
But that would be on your for misusing the length method. All the built-in and popular libraries would still define length properly.
Re:Why Is Python Growing So Quickly? by xapata on Thursday September 14, 2017 @07:09PM (#15253234)
Perhaps, but "your" mistake might impede the popularity of the language. A wide range of well-designed community libraries are a major reason to choose Python.

Take a look at the design rationale for the new __matmul__ magic method. It's not for the standard library, it's for the community.

Re:Why Is Python Growing So Quickly? by antonvs on Thursday September 14, 2017 @03:51PM (#15251906)
The need to do that reveals a couple of weaknesses (or more charitably, tradeoffs) of Python: lack of type constraints, and (related) lack of well-defined, invariant interfaces on objects.
Re:Why Is Python Growing So Quickly? by xapata on Thursday September 14, 2017 @06:17PM (#15252946)
Trade-offs indeed. Magic methods indicate the use of interfaces defined by traits rather than formal types. Duck Typing. It's flexible.

But you can also see that Guido has been into types lately. He's been pushing the development of mypy and the new optional type system.

Re:Why Is Python Growing So Quickly? by dom0 on Thursday September 14, 2017 @02:05PM (#15250734)
Ruby is just used rarely outside RoR, realistically speaking.
Re:Why Is Python Growing So Quickly? by trcollinson on Thursday September 14, 2017 @03:09PM (#15251456)
Actually, you should qualify that a bit more. Ruby is rarely used outside of Ruby on Rails in North America. In Japan, it is widely used and Ruby on Rails is fair less common.
Re:Why Is Python Growing So Quickly? by ksec on Thursday September 14, 2017 @03:14PM (#15251526)
What were Ruby used for in japan?
Re:Why Is Python Growing So Quickly? by trcollinson on Friday September 15, 2017 @12:04AM (#15254542)
Ruby is a very versatile language in its own right. While the other poster is correct that it is used for anything that perl and python are used for it's also taking a large chunk from the Java and C# crowd in Japan. Everything from server side applications to command line tools and even GUI based desktop applications can be written in Ruby. Using FFI I have made some quite amazing applications with Ruby.

Rails is amazing and I personally love it. But it's not the only thing Ruby is good for.

Re:Why Is Python Growing So Quickly? by goatlover on Thursday September 14, 2017 @04:08PM (#15252036)
Probably anything that Perl and Python are used for.
Re:Why Is Python Growing So Quickly? by rpazyaquian on Thursday September 14, 2017 @03:12PM (#15251503)
Well, true, you have a point. Ruby is rarely used outside of Rails. Which is a shame, really.
Re:Why Is Python Growing So Quickly? by schneems on Thursday September 14, 2017 @04:09PM (#15252048)
Go to Japan.
Re:Why Is Python Growing So Quickly? by submeta on Thursday September 14, 2017 @02:33PM (#15251032)
Whitespace is no issue with a good editor (Sublime, vim, emacs...).

I dislike the many inconsistencies in Python. You mentioned one. Others: sort vs sorted (destructive vs non destructive). Also: not being able to chain methods because many don't return a value. (Scheme, Elixir or even Ruby are imho much more elegant.)

But all in all Python is a very useful programming language with a rich eco system.

Re:Why Is Python Growing So Quickly? by xapata on Thursday September 14, 2017 @06:41PM (#15253086)
The Python design FAQ explains that .append and .sort return None to remind you they are mutation methods. I find this more elegant than Ruby, etc., where many things look like pure functions but aren't.

https://docs.python.org/2/faq/design.html#why-doesn-t-list-s...

Re:Why Is Python Growing So Quickly? by submeta on Friday September 15, 2017 @04:07PM (#15260338)
I know the reasons why and how mutating methods work in Python.

Nevertheless I find this here much more elegant:

data.sort.tail.first # or this data.append(7).append(3)

More elegant than this:

sorted(data)[1:][0]

data.append(7) # and then

data.append(3)

I love method chaining in Elixir or Javascript. In Python I have to create temp variables here and there to capture / further process intermediate results.

Having said that: Python has it's strengths. I use it more than any other programming language.

Re:Why Is Python Growing So Quickly? by xapata on Friday September 15, 2017 @06:28PM (#15261333)
I understand the preference and the difficulty created by methods and operators that are essentially statements instead of expressions. However, when making that criticism we should also acknowledge the benefit of requiring or encouraging multiple lines for those actions.

    if (x=42) {}
Has burned many people. Append having a useful return is comparable, though probably not as much of a trap.

> sorted(data)[1:][0]

I don't want to get into the weeds, but shouldn't that just be

    sorted(data)[1]
Or if you like unpacking for clarity

    first, second = sorted(data)[:2]

?
Re:Why Is Python Growing So Quickly? by kbenson on Thursday September 14, 2017 @01:10PM (#15250076)
> Had Perl or Ruby been the premier language to use for DS/ML, they would be growing instead of Python.

Well Perl was the premiere data science language for a while. Python made inroads and eventually took over. I think you're mostly right through, it's just a matter of other factors affecting the communities at the time causing Perl to not grow nearly as quick as Python, and Python getting a good numeric library. Had Perl not lost a lot of community in the early 2000's, it might have retained this area.

Re:Why Is Python Growing So Quickly? by cutler on Thursday September 14, 2017 @01:47PM (#15250512)
Perl just lost the plot. I think BioPerl was ahead of the game before the Python scientific libraries stole the show so they only have themselves to blame. Perl's successor Ruby seems to be headed in the same direction by failing to diversify which is a shame because Ruby is much better language than Python.
Re:Why Is Python Growing So Quickly? by empath75 on Thursday September 14, 2017 @12:48PM (#15249818)
You still have to explain why python is the premier language for that.
Re:Why Is Python Growing So Quickly? by pletnes on Thursday September 14, 2017 @01:09PM (#15250072)
Libraries. And to build them you need certain language features. 2 big ones: complex numbers and operator overloading. The lack of these meant that everyone doing simulation and data analysis skipped Java altogether.
Re:Why Is Python Growing So Quickly? by msla on Thursday September 14, 2017 @01:05PM (#15250023)
The reason C is so popular is because it's the scripting language of Unix. C++ is the scripting language of Windows. Objective-C, Macs and iOS.

Well, Python is the scripting language of a ton of useful libraries which are relevant to a lot of very interesting fields.

R sits in a similar spot, but Python is a better, friendlier language, which means actual programmers are more apt to recommend it as an offhand solution to a simple problem someone who isn't seen as a programmer is having: "Oh, that's easy. Just copy and paste this Python code, and maybe hack at it until it does something." You can get scientists programming with recommendations like that.

Re:Why Is Python Growing So Quickly? by SimbaOnSteroids on Thursday September 14, 2017 @02:06PM (#15250740)
"It's psuedo-code that works"
Re:Why Is Python Growing So Quickly? by lou1306 on Thursday September 14, 2017 @02:56PM (#15251291)
This. I took the habit of writing very Python-like pseudocode while taking lecture notes, and having it run almost verbatim at home was a blast.
Re:Why Is Python Growing So Quickly? by SimbaOnSteroids on Thursday September 14, 2017 @05:18PM (#15252595)
Honestly if other languages had the ability to use words like and, or, not, foreach <thing> in <thing> it would make learning to code that much more accessible. Even a language like C could do this. I understand that obviously you're not going to change something like a bit-wise (>>/<<) operator into something that flat says what it does (drop bit right/left), and I appreciate a good use of a ternary operator, you'd think it would be fairly trivial to de-codify some of the more basic operations.
Re:Why Is Python Growing So Quickly? by gaius on Thursday September 14, 2017 @02:06PM (#15250744)
Python has super-easy bindings to C too, that's another reason it's popular in scientific computing
Re:Why Is Python Growing So Quickly? by msla on Thursday September 14, 2017 @04:57PM (#15252454)
And because it has bindings to C, it has bindings to a lot of other languages traditionally compiled to machine language, such as Fortran and C++, making SciPy possible, because that optionally depends on LAPACK, which is written in Fortran.

https://www.scipy.org/scipylib/building/linux.html

Of course, the people who just install and run SciPy don't need to know that, but the fact Python has a nice C FFI means it can run literally decades' worth of software across a fair number of languages.

Re:Why Is Python Growing So Quickly? by dekhn on Thursday September 14, 2017 @03:50PM (#15251897)
I'd be using lua if it had python's library breadth. Or maybe julia. Not python.