Need advice about which tool to choose?Ask the StackShare community!
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.
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.
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.
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.
Pros of Python
- Great libraries1.1K
- Readable code921
- Beautiful code815
- Rapid development764
- Large community669
- Open source414
- Elegant375
- Great community264
- Object oriented257
- Dynamic typing206
- Great standard library68
- Very fast51
- Functional programming47
- Scientific computing33
- Easy to learn31
- Great documentation29
- Matlab alternative25
- Productivity22
- Easy to read21
- Simple is better than complex19
- It's the way I think17
- Imperative17
- Very programmer and non-programmer friendly15
- Powerful14
- Free14
- Fast and simple13
- Powerfull language13
- Scripting12
- Explicit is better than implicit9
- Machine learning support9
- Unlimited power8
- Ease of development8
- Import antigravity7
- Clear and easy and powerfull7
- It's lean and fun to code6
- Print "life is short, use python"6
- Great for tooling5
- Fast coding and good for competitions5
- There should be one-- and preferably only one --obvious5
- Python has great libraries for data processing5
- High Documented language5
- I love snakes5
- Although practicality beats purity5
- Flat is better than nested5
- Readability counts4
- Multiple Inheritence3
- Complex is better than complicated3
- Lists, tuples, dictionaries3
- Rapid Prototyping3
- Plotting3
- Socially engaged community3
- Great for analytics3
- Beautiful is better than ugly3
- CG industry needs3
- No cruft2
- Easy to learn and use2
- List comprehensions2
- Generators2
- Special cases aren't special enough to break the rules2
- Now is better than never2
- If the implementation is hard to explain, it's a bad id2
- If the implementation is easy to explain, it may be a g2
- Simple and easy to learn2
- Import this2
- It is Very easy , simple and will you be love programmi1
- Because of Netflix1
- Web scraping1
- Better outcome1
- Batteries included1
- Powerful language for AI1
- Easy to setup and run smooth1
- Pip install everything1
- Only one way to do it1
- A-to-Z1
- Many types of collections1
- Flexible and easy1
- Pro0
- Powerful0
Pros of Swift
- Ios248
- Elegant175
- Not Objective-C123
- Backed by apple105
- Type inference89
- Generics57
- Playgrounds51
- Semicolon free47
- OSX37
- Tuples offer compound variables34
- Clean Syntax21
- Easy to learn21
- Open Source19
- Functional19
- Beautiful Code16
- Linux10
- Dynamic9
- Promotes safe, readable code9
- Protocol-oriented programming7
- No S-l-o-w JVM7
- Explicit optionals7
- Storyboard designer5
- Best UI concept4
- Super addicting language, great people, open, elegant4
- Faster and looks better3
- Type safety3
- Optionals3
- Swift is faster than Objective-C2
- Native2
- Highly Readable codes2
- Feels like a better C++2
- Its fun and damn fast2
- Protocol extensions2
- MacOS1
- Optional chain1
- Protocol as type1
- Protocol oriented programming1
- Type Safe1
- Objec1
- Actually don't have to own a mac1
- Strong Type safety1
- Powerful1
- Fail-safe1
- Can interface with C easily1
- Easy to learn and work1
- Its friendly1
- Easy to Maintain1
- Much more fun1
- Esay1
- Numbers with underbar1
- Swift is easier to understand for non-iOS developers.0
Sign up to add or upvote prosMake informed product decisions
Cons of Python
- Still divided between python 2 and python 348
- Performance impact26
- Poor syntax for anonymous functions26
- Package management is a mess18
- GIL18
- Too imperative-oriented13
- Hard to understand12
- Dynamic typing10
- Very slow8
- Not everything is expression8
- Indentations matter a lot7
- Explicit self parameter in methods7
- Poor DSL capabilities6
- No anonymous functions6
- Requires C functions for dynamic modules6
- The "lisp style" whitespaces5
- Hard to obfuscate5
- The benevolent-dictator-for-life quit4
- Lack of Syntax Sugar leads to "the pyramid of doom"4
- Threading4
- Fake object-oriented programming4
- Incredibly slow4
- Not suitable for autocomplete3
- Official documentation is unclear.3
- Circular import2
- Training wheels (forced indentation)1
- Meta classes1
Cons of Swift
- Must own a mac2
- Memory leaks are not uncommon2
- Its classes compile to roughly 300 lines of assembly1
- Complicated process for exporting modules1
- Very irritatingly picky about things that’s1
- Is a lot more effort than lua to make simple functions1
- Overly complex options makes it easy to create bad code0