Python vs Swift

Need advice about which tool to choose?Ask the StackShare community!

Python

116.4K
90.6K
+ 1
6.4K
Swift

11.4K
7.9K
+ 1
1.2K
Add tool

Python vs Swift: What are the differences?

What is Python? A clear and powerful object-oriented programming language, comparable to Perl, Ruby, Scheme, or Java. Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.

What is Swift? An innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project — or for addition into your current app — because Swift code works side-by-side with Objective-C.

Python and Swift can be primarily classified as "Languages" tools.

"Great libraries", "Readable code" and "Beautiful code" are the key factors why developers consider Python; whereas "Ios", "Elegant" and "Not Objective-C" are the primary reasons why Swift is favored.

Python and Swift are both open source tools. It seems that Swift with 48.2K GitHub stars and 7.71K forks on GitHub has more adoption than Python with 25K GitHub stars and 10.3K GitHub forks.

According to the StackShare community, Python has a broader approval, being mentioned in 2789 company stacks & 3500 developers stacks; compared to Swift, which is listed in 979 company stacks and 526 developer stacks.

Decisions about Python and Swift

Python has become the most popular language for machine learning right now since almost all machine learning tools provide service for this language, and it is really to use since it has many build-in objects like Hashtable. In C, you need to implement everything by yourself.

C++ is one of the most popular programming languages in graphics. It has many fancy libraries like eigen to help us process matrix. I have many previous projects about graphics based on C++ and this time, we also need to deal with graphics since we need to analyze movements of the human body. C++ has much more advantages than Java. C++ uses only compiler, whereas Java uses compiler and interpreter in both. C++ supports both operator overloading and method overloading whereas Java only supports method overloading. C++ supports manual object management with the help of new and delete keywords whereas Java has built-in automatic garbage collection.

See more
Kirill Mikhailov

Go is a way faster than both Python and PHP, which is pretty understandable, but we were amazed at how good we adapted to use it. Go was a blessing for a team , since strict typing is making it very easy to develop and control everything inside team, so the quality was really good. We made huge leap forward in dev speed because of it.

See more
Chose
PythonPython
over
ScalaScala

I am working in the domain of big data and machine learning. I am helping companies with bringing their machine learning models to the production. In many projects there is a tendency to port Python, PySpark code to Scala and Scala Spark.

This yields to longer time to market and a lot of mistakes due to necessity to understand and re-write the code. Also many libraries/apis that data scientists/machine learning practitioners use are not available in jvm ecosystem.

Simply, refactoring (if necessary) and organising the code of the data scientists by following best practices of software development is less error prone and faster comparing to re-write in Scala.

Pipeline orchestration tools such as Luigi/Airflow is python native and fits well to this picture.

I have heard some arguments against Python such as, it is slow, or it is hard to maintain due to its dynamically typed language. However cost/benefit of time consumed porting python code to java/scala alone would be enough as a counter-argument. ML pipelines rarerly contains a lot of code (if that is not the case, such as complex domain and significant amount of code, then scala would be a better fit).

In terms of performance, I did not see any issues with Python. It is not the fastest runtime around but ML applications are rarely time-critical (majority of them is batch based).

I still prefer Scala for developing APIs and for applications where the domain contains complex logic.

See more
Pros of Python
Pros of Swift
  • 1.1K
    Great libraries
  • 921
    Readable code
  • 815
    Beautiful code
  • 764
    Rapid development
  • 669
    Large community
  • 414
    Open source
  • 375
    Elegant
  • 264
    Great community
  • 257
    Object oriented
  • 206
    Dynamic typing
  • 68
    Great standard library
  • 51
    Very fast
  • 47
    Functional programming
  • 33
    Scientific computing
  • 31
    Easy to learn
  • 29
    Great documentation
  • 25
    Matlab alternative
  • 22
    Productivity
  • 21
    Easy to read
  • 19
    Simple is better than complex
  • 17
    It's the way I think
  • 17
    Imperative
  • 15
    Very programmer and non-programmer friendly
  • 14
    Powerful
  • 14
    Free
  • 13
    Fast and simple
  • 13
    Powerfull language
  • 12
    Scripting
  • 9
    Explicit is better than implicit
  • 9
    Machine learning support
  • 8
    Unlimited power
  • 8
    Ease of development
  • 7
    Import antigravity
  • 7
    Clear and easy and powerfull
  • 6
    It's lean and fun to code
  • 6
    Print "life is short, use python"
  • 5
    Great for tooling
  • 5
    Fast coding and good for competitions
  • 5
    There should be one-- and preferably only one --obvious
  • 5
    Python has great libraries for data processing
  • 5
    High Documented language
  • 5
    I love snakes
  • 5
    Although practicality beats purity
  • 5
    Flat is better than nested
  • 4
    Readability counts
  • 3
    Multiple Inheritence
  • 3
    Complex is better than complicated
  • 3
    Lists, tuples, dictionaries
  • 3
    Rapid Prototyping
  • 3
    Plotting
  • 3
    Socially engaged community
  • 3
    Great for analytics
  • 3
    Beautiful is better than ugly
  • 3
    CG industry needs
  • 2
    No cruft
  • 2
    Easy to learn and use
  • 2
    List comprehensions
  • 2
    Generators
  • 2
    Special cases aren't special enough to break the rules
  • 2
    Now is better than never
  • 2
    If the implementation is hard to explain, it's a bad id
  • 2
    If the implementation is easy to explain, it may be a g
  • 2
    Simple and easy to learn
  • 2
    Import this
  • 1
    It is Very easy , simple and will you be love programmi
  • 1
    Because of Netflix
  • 1
    Web scraping
  • 1
    Better outcome
  • 1
    Batteries included
  • 1
    Powerful language for AI
  • 1
    Easy to setup and run smooth
  • 1
    Pip install everything
  • 1
    Only one way to do it
  • 1
    A-to-Z
  • 1
    Many types of collections
  • 1
    Flexible and easy
  • 0
    Pro
  • 0
    Powerful
  • 248
    Ios
  • 175
    Elegant
  • 123
    Not Objective-C
  • 105
    Backed by apple
  • 89
    Type inference
  • 57
    Generics
  • 51
    Playgrounds
  • 47
    Semicolon free
  • 37
    OSX
  • 34
    Tuples offer compound variables
  • 21
    Clean Syntax
  • 21
    Easy to learn
  • 19
    Open Source
  • 19
    Functional
  • 16
    Beautiful Code
  • 10
    Linux
  • 9
    Dynamic
  • 9
    Promotes safe, readable code
  • 7
    Protocol-oriented programming
  • 7
    No S-l-o-w JVM
  • 7
    Explicit optionals
  • 5
    Storyboard designer
  • 4
    Best UI concept
  • 4
    Super addicting language, great people, open, elegant
  • 3
    Faster and looks better
  • 3
    Type safety
  • 3
    Optionals
  • 2
    Swift is faster than Objective-C
  • 2
    Native
  • 2
    Highly Readable codes
  • 2
    Feels like a better C++
  • 2
    Its fun and damn fast
  • 2
    Protocol extensions
  • 1
    MacOS
  • 1
    Optional chain
  • 1
    Protocol as type
  • 1
    Protocol oriented programming
  • 1
    Type Safe
  • 1
    Objec
  • 1
    Actually don't have to own a mac
  • 1
    Strong Type safety
  • 1
    Powerful
  • 1
    Fail-safe
  • 1
    Can interface with C easily
  • 1
    Easy to learn and work
  • 1
    Its friendly
  • 1
    Easy to Maintain
  • 1
    Much more fun
  • 1
    Esay
  • 1
    Numbers with underbar
  • 0
    Swift is easier to understand for non-iOS developers.

Sign up to add or upvote prosMake informed product decisions

Cons of Python
Cons of Swift
  • 48
    Still divided between python 2 and python 3
  • 26
    Performance impact
  • 26
    Poor syntax for anonymous functions
  • 18
    Package management is a mess
  • 18
    GIL
  • 13
    Too imperative-oriented
  • 12
    Hard to understand
  • 10
    Dynamic typing
  • 8
    Very slow
  • 8
    Not everything is expression
  • 7
    Indentations matter a lot
  • 7
    Explicit self parameter in methods
  • 6
    Poor DSL capabilities
  • 6
    No anonymous functions
  • 6
    Requires C functions for dynamic modules
  • 5
    The "lisp style" whitespaces
  • 5
    Hard to obfuscate
  • 4
    The benevolent-dictator-for-life quit
  • 4
    Lack of Syntax Sugar leads to "the pyramid of doom"
  • 4
    Threading
  • 4
    Fake object-oriented programming
  • 4
    Incredibly slow
  • 3
    Not suitable for autocomplete
  • 3
    Official documentation is unclear.
  • 2
    Circular import
  • 1
    Training wheels (forced indentation)
  • 1
    Meta classes
  • 2
    Must own a mac
  • 2
    Memory leaks are not uncommon
  • 1
    Its classes compile to roughly 300 lines of assembly
  • 1
    Complicated process for exporting modules
  • 1
    Very irritatingly picky about things that’s
  • 1
    Is a lot more effort than lua to make simple functions
  • 0
    Overly complex options makes it easy to create bad code

Sign up to add or upvote consMake informed product decisions

What is Python?

Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.

What is Swift?

Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project — or for addition into your current app — because Swift code works side-by-side with Objective-C.

Need advice about which tool to choose?Ask the StackShare community!

What companies use Python?
What companies use Swift?

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Python?
What tools integrate with Swift?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

Sep 29 2020 at 7:36PM
https://img.stackshare.io/company/165617/cbd54fc70c90bdc732b07283f2a61ca8fb8980bd.png logo

WorkOS

PythonSlackG Suite+17
6
2108
PythonDockerKubernetes+7
3
598
PythonDockerAmazon S3+14
11
1883
Oct 3 2019 at 7:13PM
https://img.stackshare.io/stack/511159/default_5f04358e03a27bf2607a39dd9b409dd7830ce4d3.png logo

Ably Realtime

JavaScriptPythonNode.js+8
4
3123
Aug 28 2019 at 3:10AM
https://img.stackshare.io/stack/505487/default_e35b8bd5e615e01dc9b420dbd2a444fcbaeff755.png logo

Segment

PythonJavaAmazon S3+16
5
1891
JavaScriptPythonPubNub+4
7
909
GitHubPythonReact+42
46
38546
What are some alternatives to Python and Swift?
Java
Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!
R Language
R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible.
JavaScript
JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
Scala
Scala is an acronym for “Scalable Language”. This means that Scala grows with you. You can play with it by typing one-line expressions and observing the results. But you can also rely on it for large mission critical systems, as many companies, including Twitter, LinkedIn, or Intel do. To some, Scala feels like a scripting language. Its syntax is concise and low ceremony; its types get out of the way because the compiler can infer them.
Anaconda
A free and open-source distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system conda.
See all alternatives
Interest over time