DEV Community

Bosco Kalinijabo
Bosco Kalinijabo

Posted on

Kotlin vs Python

Recently I’ve started learning Kotlin. It was not my first time looking into it, But you are aware that you can even forget how to declare a variable in a certain language if you do not use it regularly, that’s my story. In 2019 I learnt Kotlin with Kotlin in Action Book, but never had space to use it until now as my work is asking me to open that book again.

If you love Python and use it often as I do, the bad news is, in some case It might not work for you for a certain project. Python is the best dynamic language, but it is worth learning a statistically typed language. Large projects demand the rigour of a statically typed language, Kotlin can provide that rigour with no drawbacks such as verbose syntax.
From the couple days I have been learning Kotlin, I have noticed some difference, from their name to the their extension 😉

· Kotlin is a statically programming language while Python is dynamic.
· Python is easier to learn and read than kotlin ( it would depend on your readability.
· They are all open source tools
· They are all cross platforms – ( compatible with many operating system)
· Var or Val when declaring in kotlin, but no formula to declare a variable in python
· Both don’t bother with semicolon at the end of the syntax
· Kotlin looks familiar with Java while Python is comparable to Ruby
· Both are used in web development ( Django, flask for python, and Spring Boot , javelin for Kotlin )
· Both can be used in Backend development side
· Kotlin has a huge advantage over python in mobile development ( Android )
· Kotlin is Backed up by Google
· Kotlin is faster to compile
· Kotlin provides built-in null safety support
· Kotlin is compatible with all java libraries
· Kotlin user Junit ( 4,5), mocks, Assertion tests while python use unit test or integration test
· They all have many built in functions ( for instance math ).

Let’s see how they are different syntax.

image

I may conclude by saying, if you want to start coding, python is the best suit to start on as it was not hard for me when i was learning it but Kotlin is like butter over bread. Having Kotlin as an additional language will help us (you ) target more solutions, and you become more valuable on market.

Top comments (3)

Collapse
 
josealonso profile image
José Ramón (JR)

I don't like using dynamic languages for large applications, because the developer experience is much worse (your IDE cannot show you all the methods for a given class) and some errors cannot be detected at compile time. I still don't understand the popularity of Nodejs and Python in non-trivial applications. In fact, important Javascript application are now written in Typescript and type hints annotations were introduced in Python 3.6. Although type hints are not enforced at runtime by the Python interpreter, they can only be used by external tools for static type checking and code analysis. It's not a coincidence that the well-known FastAPI python framework leverages those type annotations to enhance the reliability and maintainability of the code.
Kotlin is a great language, because it has static typing and type inference. Almost all the languages are based on C, which has static types, too. A (static) type system is an essential part of a serious programming language. It's not a trivial feature.

Collapse
 
turry profile image
Turry

Nice article. Keep up!

Collapse
 
sababu_ profile image
Bosco Kalinijabo

Thank you