12 ms·
I do both Kotlin and Python. More Kotlin than Python to be honest. But I'm pragmatic. Python is where all the action is when it comes to data science, llms, and
by jillesvangurp 2y ago
I do both Kotlin and Python. More Kotlin than Python to be honest. But I'm pragmatic. Python is where all the action is when it comes to data science, llms, and all the rest. So it's the path of the least resistance. And there's a great argument to not challenge that and just do what everybody else does and put your head down and not criticize any of that. Which is why I use it on a few projects. The library ecosystem is great. Etc. Bla bla bla. But the bottom line is that I don't love python. It's dreary to me. Mediocre. I can't get very excited about any of it. It just seems so backwards.
And it's not necessarily the most efficient path either. The interpreter is not that fast, the language is not that expressive, what passes for package management is a bad joke, etc. I can work with it but I'm not necessarily loving it.
For data engineering, Kotlin has a lot to offer. I wouldn't necessarily recommend it because it's all kind of niche. But it kind of works as well. If you aren't afraid of tinkering with it, there are a lot of other niche solutions out there as well that aren't python.
Kotlin is what I reach for when I want to get stuff done in a hurry. Part of that is just my limitation. It's what I know and I kind of grew up on JVM languages. I'm well aware that's not necessarily optimal and that that's just a bias I have. But objectively, it has a lot of nice things over modern python as well.
Kotlin is a modern language, it's a lot more expressive than python. It has a a great library ecosystem. Including some stuff that does not depend on the JVM. And even though it's kind of niche for a lot of things I use it for (e.g. developing reactive web frontends), it holds up well and rarely disappoints me.
People use python because everybody else uses python. That's it. It's not particularly good at anything it does. But it will get the job done and I can do it. But that just isn't good enough for me. It's the visual basic for data science. And that's not a compliment. Being idiot proof is it's main feature. But that doesn't make it the smart choice.
- esafak 2y agoKotlin just needs some stubborn people not to use python just because everyone else does, and build up the Kotlin ecosystem. That's how progress is made.
- poikroequ 2y agoI think both languages have their strengths. I love Kotlin for its functional programming (map, filter, etc) and strong static typing. But Python has some nice features as well, such as list comprehension, the 'yield' keyword, and annotations are super simple to implement.
- lolinder 2y agoAre there things that you find easier to express in a list comprehension format than you do with Kotlin's standard library? I've always found comprehensions to be a bit of a workaround to the fact that Python doesn't have great support for anonymous functions, and I've never found a situation where I'm writing Kotlin really wishing I had a comprehension.
- poikroequ 2y agoA bit of a contrived example, but something like this (two for statements): [x*y for x in range (10) for y in range(10)] It's not often, but occasionally there are moments where I'm writing code in Kotlin and wish I could use a list comprehension. I do prefer Kotlin overall, but there's a few things that I think would be "nice to have" from Python. Especially the yield keyword, such a wonderful way to write your own iterators.
- lolinder 2y agoHmm, I actually prefer Kotlin's version, but maybe that's just because it's what I'm used to: (0..10).flatMap { x -> (0..10).map { y -> x * y } } The flow of the data is more intuitive for me because you don't use variables before they're defined. > Especially the yield keyword, such a wonderful way to write your own iterators. Maybe I'm missing something about `yield` in Python—can it do something that Kotlin generators can't?
- hughesjj 2y agoIt's mostly ease of semantics -- in your example you use two layers of map and as a result need to do flatMap instead of just map twice In py, for list/set/dictionary/generator comprehensions, the format is always the same and always the same as if you were to do it as a normal nested loop, save for the statement being first instead of last (you can also do filters using normal if statement syntax, these go at the end/after all your loops). I actually like statement first because it gets to the "meat" of the semantics before the context (which loop etc), but end do the day it's all a bit arbitrary @ yield, there's literally no difference between Python and kotlin. Python also offers a generator comprehension, which is nice, but it has nothing to do with yield i_am_a_generator = ( x+1 for x in range(10*100) )
- Blot2882 2y agoI'm not sure how someone could see Kotlin as more expressive than Python, unless I am misinterpreting what expressive means. Python has a good language features and helpful abstractions like list comprehensions. What makes Kotlin more expressive? I understand it has some functional features but I've never seen anything dramatically flexible.
- jonesetc 2y agoThe biggest thing that wouldn't be available in Python would be the DSLs. Often they are not my favorite and overused, but they can be very expressive for things like their charting example https://kotlinlang.org/docs/data-analysis-overview.html#kandy https://kotlinlang.org/docs/data-analysis-overview.html#kand...
- lolinder 2y agoKotlin's standard library has ruined me for other languages, especially its collections library. The consistency and comprehensiveness of its approach to collections is unmatched in any language I've tried, including all the big name functional languages. It's hard to get across what's so great about the library in writing because it's not just one standard library function, it's how they all interact with each other and how they interact with the language design—you really just have to try it to understand. The net result is that transforming data from one shape to another flows effortlessly, with the dot operator seamlessly connecting a stream of transformations. The fact that it's the dot operator also means that you get really great autocomplete to help you on your way. Python, meanwhile, has always felt pretty awkward to me when it comes to data transformations. Comprehensions are okay, but they feel like they are special casing what should be a bunch of standardized helper functions operating on lambdas, as a sort of ugly workaround to the fact that Python refuses to implement proper lambdas. And when you can't use a comprehension, you're stuck with a pretty awkward collection of helper methods that are hard to find and use correctly and which are severely handicapped in expressivity by the lack of a proper lambda.
- Blot2882 2y agoThat's interesting. I've heard complaints about Kotlins standard library in comments like this[1]. I understand they may be nitpicks but they seem annoying in practice. [1] https://www.reddit.com/r/Kotlin/comments/mh2z5u/comment/gt2nv9o/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button https://www.reddit.com/r/Kotlin/comments/mh2z5u/comment/gt2n...
- clumsysmurf 2y agoHave you looked at https://www.modular.com/mojo https://www.modular.com/mojo Sounds like it has a good Python interop story.
- samstave 2y agoWhat about position, with kotlin language support: https://i.imgur.com/SjbtX2z.png https://i.imgur.com/SjbtX2z.png https://www.andrewheiss.com/blog/2024/07/08/fun-with-positron/ https://www.andrewheiss.com/blog/2024/07/08/fun-with-positro...
- jillesvangurp 2y agoThe vs code support for Kotlin is pretty bare-bones compared to the IDE. And I'm guessing positron reuses the extension for that; so not that interesting to me. Part of the appeal of Kotlin is Intellij offering an enormous amount of smart features that other IDEs simply don't have at all for any language.
- parpfish 2y agoI work in a codebase that’s mostly kotlin and python and I’ve come to hate the python side. I used to love python, but I feel like the attempts to tack on typing have really undermined it. The “freedom” of being untyped is nice for quick little scripting things, but being typed is an absolute godsend in a real codebase. Instead of making python pseudo-typed with messy annotations, the scientific/research community should have built out tools in an actually typed language. I think Julia hung around for years with the expectation that people were going to do that
- bcye 2y agoWhat kind of codebase would be mostly a Kotlin/Python combo?
- yen223 2y agoKotlin Android app with a Python backend for ML stuff, maybe? Or maybe they're in one of those places that use microservices with a variety of languages
- mike_hearn 2y agoYes but it's reasonable that they didn't. For quick hacky scripts you really want a lightweight syntax that supports interactive REPL exploration. Kotlin is the first language that manages to combine a strict static type system with a Python-weight syntax, and there's a REPL too although I don't think it gets much use. These days notebooks are a better replacement for REPLs anyway when doing data analysis, but Kotlin only got support for such features very recently.
- hocuspocus 2y agoKotlin isn't the first language offering any of these features, not even remotely. Even if you look only at the JVM: Scala is much older.
- binkHN 2y ago
- hughesjj 2y agoThis is exactly it for me too. Kotlin is my favorite overall language to code in, but for data analysis I'm going python for ecosystem or Julia if I need performance.
- bormaj 2y ago> The interpreter is not that fast, the language is not that expressive, what passes for package management is a bad joke, etc. I can work with it but I'm not necessarily loving it. These are rather disingenuous criticisms of python. The utility of any language is measured by its use as a means to some end. It's clear that Python's ecosystem has prospered not just because it's a fad, but because it's actually useful. Not perfect, but useful. Python can be improved, but I'm sure most other tools/languages can be equally criticized.
- lolinder 2y agoPython in data is similar to C in systems: it's not the best language for the job, but it was good enough at a critical point in history that it became the standard by happenstance—there weren't enough things wrong with it to repel the Brownian motion of developers from seeding the ecosystem—and now it's the best language for the job because it's the standard. > These are rather disingenuous criticisms of python. The utility of any language is measured by its use as a means to some end. It's clear that Python's ecosystem has prospered not just because it's a fad, but because it's actually useful. Not perfect, but useful. Your criticisms of OP's argument are more disingenuous than OP: no one said Python was a fad or that the ecosystem wasn't useful. See here: > Python is where all the action is when it comes to data science, llms, and all the rest. So it's the path of the least resistance. And there's a great argument to not challenge that and just do what everybody else does and put your head down and not criticize any of that. Which is why I use it on a few projects. The library ecosystem is great. They're just saying that Python-the-language isn't their favorite (largely subjective but with a lot of agreement from much of the community) and they mention offhand that Python's package management is a disaster (which is 100% accurate).
- bormaj 2y agoI have no qualms with the OPs comment other than the same criticisms I highlighted could be applied to just about any other language in a similarly vague context. So what justice do those criticisms do if we're not being specific about them? For example > Package management is a disaster > The interpreter is slow > The syntax is not expressive Is your particular experience with pip bad? Or is it poetry/conda or another upstart project? Are you working with a monorepo? In what use case is the interpreter slow? The syntax is not expressive (for what)? My point about tooling/utility is that how you use a tool matters a lot (and maybe I didn't express that in my original reply).
- cageface 2y agoI would love to have an excuse to spend most of my time in Kotlin but unfortunately it's not a good fit for the apps I build. It's really a lovely language. Maybe if Kotlin Multiplatform really takes off.
- mobiuscog 2y agoI'm often surprised C# hasn't gained more traction in this regard, but I guess that (despite .NET Core being open) it's a 'Microsoft' problem.