Python: Still in favor?

Ruth Reyer on September 17, 2018

A couple of summers ago I learned Python and Django via Hello Web App. I absolutely loved the structure of this book and thought Python was super... [Read Full]
markdown guide
 

I've been an active user of Python for maybe 5+ years (and I've continued using other languages as well), and there seems to be no real reason to dislike Python other than FUD ("GIL ruins performance" -type shouting). However there are of course cases where Python isn't the best language, and e.g. Go, C#, Rust, or generally just something else would be better. Nowadays it's actually more like my default assumption, that unless there's any special reason to NOT do it in Python, I'd rather do it in Python (I also quite often fall back to Go as the alternative).

Generally if you want to build something for the long term, something that is potentially going to grow to be massive, or you'd want an ability to easily refactor, then Python is an excellent choice. It's easy for people to learn to be efficient at, so you don't even need to hire "Python programmers" to grow your team. It has an excellent community with strong belief in standards, and tools exist for pretty much everything you can ever imagine. Compared to most other languages it can make a programmer feel like a superhero due to how productive they can really be.

If you're building for web, performance is rarely a concern at all (horizontal scaling is much more important), and PyPy, Cython, etc. can alleviate most of those concerns in other cases. However, if you TRULY need multithreading, or massive concurrency, depending on your specific use-case Python might prove to be problematic (but e.g. gevent, multithreading, multiprocessing, and Stackless Python might be good enough for you anyway).

Going with a big framework like Django is quite often a bad idea, they impose design choices on you without any good reason, but it all depends on your use cases. I've successfully built good software on Django, Tornado, Flask, Falcon, and others so it really matters little in the end.

If you have any special needs in mind, check those first. If you don't, try something lightweight and well known, e.g. Flask, you can always slap on more components later. All those mentioned above are really good choices, and there are others that are good too.

 

Exactly the kind of information I was looking for. Thanks!

 

Hello, I'm primarily a PHP developer and have worked with Python a bit. My advice? Please stop reading up these pointless and time-consuming discussions. Please also stop wondering if your stack is good or bad. As long as you pick an active and famous language, you can't go wrong. The time to switch will come eventually no matter what you choose right now, so stick with what makes sense to you. Focus on the positive things and on building stuff; there are enough worries in life as it is. :-)

 

I too am a PHP Developer. And I agree with you. There is so much hate for both PHP and Python. And people shouldn't let it stop them from learning it.

 

Well, at least go with any language that won't be any wrong-er than stupid made-up languages which were never intended for big things like Brianfuck, Malbolge or PHP.

Don't get me wrong, I don't hate Brainfuck, I just don't recommend using it in real life.

 

python's community , its huge ......one can gain insight in any topic within internet

Firstly as a college project i choose flask for web app development
As for the reason python is my lang of choice is because it is easy to learn for any level of developers

Django is #1 framework for web development in python language. I cannot know your taste but i can ask you for a try. Then decide by self experience.

Keep Coding..........!!!

 

Not much to add aside from other comments. What I don't understand is this apparent hate of Django. Don't you guys ever use a database? The Django ORM brings safety, simplicity and migrations to your code at a cost that you can well afford. How do you do without? I don't intend to go back in the 2000s.

 

What I don't understand is this apparent hate of Django

I don't hate it. I prefer smaller frameworks like Flask

The Django ORM brings safety, simplicity and migrations to your code at a cost that you can well afford

So does Flask with Flask-SQLAlchemy

:-)

 

I get the point of not taking something too big but in the end on any real-life project I've always needed most of Django's main features. If it's to progressively assemble all of Django's pieces but differently I find that it's a waste of time...

I think there's value in being able to make the choice of what pieces to assemble. I like Django, I just don't love it. Django's admin is great though, if you're building an app that needs one :-)

Which makes me think, has anyone tested Responder yet? (from the author of Requests)

Haven't looked into it yet!

I don't know how Kenneth Reitz manages to write so many awesome libraries :D

 

Hey Ruth,
First-of-all, Twitter is written IN Python.
Python is still going strong, no doubt about it.
It is one of the most used languages in AI, Machine Learning and Deep learning circles, primarily because, the syntax is concise, the interpreter footprint in low. And, since it has been around for so long, the amount of libraries it has is just amazing.
I have built multiple projects in Python, including, VoIP traffic monitoring and fraud detection systems, IoT projects for some home automation, AI based projects to analyse datasets and predict user behavior based on cognitive models.

Django - Yes, for a full featured MVC portal, for an Enterprise Application or something. But, consider Flask too, you mentioned React is getting popular, but, that's just the frontend. Flask gives you the ability to do microservices in a jiffy and does not carry the overweight modules as in the case of Django.

 

First-of-all, Twitter is written IN Python.

Well, that's a bit of an overstatement. Twitter was notably started as a Rails app. Then they started introducing the JVM and Scala.

They use a lot of languages and stacks (included Python) but saying that Twitter is written in Python is a bit of an overstatement I think

Their open source contributions are mostly Java and Scala too.

 
 

I like Python, a lot.

I like it because it's fun to use, and because it makes solving complicated problems easier than it would be in other environments. Python has this astonishing ability to "just work", even when your problem is ridiculously complex.

I like it because its syntax is clean and free of clutter and completely sensible (mostly). I don't get the people hung up on the whitespace thing -- I thought that would bother me at first, but within the first 5 minutes of using the language I completely forgot about it. Complete non-issue.

I like it because it has an extensive ecosystem.

I like it because its core data structures are simple, sensible, and easy to use.

I like it because its runtime is solid and performs well enough for nearly everything I need to do.

I have my quibbles -- the standard library modules are oddly inconsistent in places, there are some strange gaps in functionality that crop up from time to time, datetimes are harder to use than they should be, the whole Python 3 debacle, the package management system is a bit of a mess, to name a few -- but no language is perfect.

I've built two large projects with it:

  1. A set of Python bindings to a (now very old) hierarchical storage management system API, written in C. I used SWIG to create the Python interface on top of the C API. I also built apps on top of that interface.

  2. Back end services for an extremely large financial services enterprise, mostly concerned with managing an execution framework for evaluating mortgage loan portfolios.

I've built countless smaller projects with it, mostly command line-type utilities that I might normally use a Unix shell scripting language for.

I haven't done any web dev with Python (yet), so can't comment on Django or other web frameworks.

 

Interesting, when I saw storage management systems I thought of numpy, due to it's array database style functions. numpy though I am a bit of noob when it comes to python.

 

Brilliant. Thank you for the detailed response! I like the clean syntax and sensibility of it as well.

 

By the sounds of it you're doing web programming? That being the case, I highly highly highly highly recommend checking out .NET Core, C# and Kestrel. In making it open-source Microsoft should've removed virtually any previous barriers to entry. Don't let the C-style language scare you either. If you're daft enough to learn django, than you are certainly capable of learning ASP.NET.

Some reasons I think it's a good idea:

  • Currently the most active open-source platform (most active github repos).
  • Backed by a heavyweight in Microsoft.
  • C# as a language is feature-rich (i.e. generics, functional capabilities, built-in delegate types, pattern matching)
  • Going this route also pots you a strongly typed environment, which believe me, you will be thankful for if the project achieves any kind of scale.
  • Unlike scripting languages (PHP, Python, Ruby etc.), the C# you write gets compiled into IL (Intermediate Language) which is a step closer to machine language. This is great news from a performance perspective. I recently clocked my API built on this stack at sizzling 85,000 requests per second, on a single standard virtual machine.
  • It consistently ranks in the top 10 (top 5 IIRC) of hire-able stacks.

Bottom line, Microsoft’s .NET Core web offering is ridiculously awesome and well worth a try. Gone are the days of the clunky .NET Framework.

 
 
 

Python has a special place in my heart, because it's the language I learnt how to code with about 6 years ago. That said, it's been my language of choice for many tasks since then.

I'm not saying it's the best language for those tasks (if there's even such a thing as a "best" language"), but for what I've been doing most recently (backend web development, scripting, automation, prototyping), Python has been a very strong ally.

I also enjoy those soothing moments when you write something and it just reads like pseudocode. Readability is one of the things I like the most in Python, among other things like ease of use, expressiveness or the vast ecosystem of libraries.

There are, however, some aspects I'd rather have not to deal with.

Some time ago, I would have said its dynamic typing put a high cognitive load on the developer. However, since I discovered type annotations (shameless related blog post plug), I've been really happy with what they provide, as I don't feel the need for the static typing burden.

However, the Python packaging system can be quite a pain. There is no single way of doing and the documentation is sometimes misleading. You have to think about setup.py, eggs vs wheels vs tarballs, etc… Honestly, for the beginner package developers like me (I've written my first package a month ago), that's a lot to ingest. In contrast, packaging and shipping an NPM module is a matter of filling up the package.json file.

As for Django, it's actually become go-to framework (often combined with the Django REST Framework) when I have to manage stuff (read: deal with a relational database) and have user accounts. It's got so many good practices built-in.

In contrast, if I have to build a quick API that does or computes stuff, I'd rather go with Falcon (I ditched Flask for it).

That said, I almost never use Python frameworks for frontend anymore — I must say templating systems just seem out of date now, and I prefer to use specialised JS frameworks for that.

 

I used to use Python/C/OCaml which all didn't necessarily play well together. Python and OCaml both expect their own runtimes.

Now I use Python/Rust. Rust covers the C and OCaml use cases well enough and plays very well with Python.

Python is a nice high-level language that is somewhat slow and gets messy with larger projects. However, falling back to a compiled language that can generate Python libraries makes Python(3) really hard to beat.

Python&C++ or Python&Rust are probably most viable going forward.

By the numbers, Python is currently #1 most popular language AND gaining most % use on Github: pypl.github.io/PYPL.html

 

Python is a big-time language used by Google (they use C++, Java, Python, Go), startups and academia. At the end of the day it is not necessarily the language you choose but whatever you (or your Team) are comfortable and most productive with to get the job done.

If you are looking for advice in terms of a particular vertical, Python seems to be all the range in data science it seems.

 
  1. I find Python annoying. Its performance is far from good and its "whitespace is syntax" rule hurts my brain.
  2. However, I like to write prototypes in Python, because having a working prototype up and running is really easy (and quickly done) with Python.
  3. If I have to, I'd choose Flask. I prefer as little overhead as possible.
 

I do love Python, however I understand your concern. But for the performance issue...unless you really need top execution speed it's not usually a problem. I mean, of course it is somehow slow than pure ANSI C, but at what cost?

For learning purposes and everyday problem solving it's for me one of the best languages and I tend to consider those performance problem either "corner-case" or, more commonly a wrong algorithm solution or non-optimized used of the language.

From time to time I like to revisit my old code and with better experience I always find something sub-optimal or "not pythonic way" and I'm pretty sure that affected performance.

Also, Flask is for me my usual choice hands down.

 

I mean, of course it is somehow slow than pure ANSI C, but at what cost?

You gain an uglier syntax for that - and no support for pointers. :-)

For learning purposes (...) it's for me one of the best languages

Python is a learning (and prototyping) language, it was highly influenced by ABC which was an attempt to make a "better BASIC". Python was never intended to be more than that - and this is still true. You'll reach Python's limits rather fast. I understand why Python is so popular with young developers (its entry level is sufficiently low), but one could imagine higher aspirations than to stick with your first tricycle...

 

I find python permits very readable code for the most common tasks (though things can get a bit ugly if you need to do metaprogramming or otherwise get at the plumbing). It's just pleasant to work with, and the very well-developed ecosystem means much less time is spent re-implementing things.

Rather than Django, I prefer Flask, which works well for both larger and smaller projects. I've yet to find a case where I felt like using Flask rather than something heavier was hindering me.

 

Why do you like or dislike Python?

I love the community. I love the Python way. They say it's the second best language for anything, which I think is pretty accurate. When I do any experimentation I usually jump for the Python REPL.

I dislike its handling of async stuff. I worked with Twisted and then Eventlet/gevent for specialized servers and network stuff. Moving to Go was great because it borrowed a lot from the Python way, but async was built-in and very ergonomic. Also, I'm finally sold on typed languages.

What have you built with Python and why was it the lang of choice?

We built a lot of the distributed systems management code at Twilio with Python. I don't think I'd do that again, instead opting for Go. I remember dealing with performance issues just parsing strings in Python. Not something most people will run into, but at scale in a high performance environment, it matters.

We did a lot of web apps with it, too. It used to be that because of Twisted, Python was the only good high level language for servers. A lots changed, but I still think Python is a good general purpose interpreted language.

Django yes/no? Preferred framework?

If you're building a big app or a CMS, probably. I always worked on smaller stuff so I ended up mostly using Flask.

 

I like Python because of its syntax.

I built the final project for my undergraduate with Python and React. Why Python ? Because of Django. Why Django ? Because of its slogan, "The web framework for perfectionists with deadlines."

Absolutely yes for Django if the database model is relational because NoSQL isn't officially supported yet. Otherwise, it would be NodeJS / Express

 

I like the fact that Python is easy to learn and understand, its syntax is not obscure, has lots of tools and mods, plus a great community of people out there! The community helps as it means that you are usually NOT the first one doing something, and can find many examples to help you along the way. I came into it years ago after I had spent time doing Object Perl and needed something that did similar, but was not as convoluted.

I've built a few small scripts here and there, the most exciting thing I worked on recently was a small daemon that monitored SQS queues in Amazon and after receiving specific messages about builds and deploys would launch our automated testing suite in Bamboo. We had no integration between the two systems and there were plenty of libraries to handle the AWS credentials and connections. It was set to be run daily by cron to keep it honest, while it cleaned up after itself and logged things nicely. Been going about two years now and going strong.

Never used frameworks with it, mostly just straight Python and the IDE's I have gone back and forth on between PyCharm and Notepad.

 
 

I like Python for the fact that it's easy to spin up a script to automate something. Also has a lot of libraries for just about anything you'd want to do with it.

I've worked on everything from rest api's using flask, to desktop tools. Python is great for the fact that it's easy to work with and is versatile. I still have the whitespace enforcement of the language, but a good ide can help with that.

I haven't done anything with Django, so I can't speak to that.

 

What I've come to gather about this field is that just when you think something is super cool and worth studying, twitterers start going nuts with how garbage it is.

If a language garners that strong of a polarizing opinion, you can safely assume that it is a good language to learn.


Why do you like or dislike Python?

Like: writing less code.
Dislike: writing less code.

What have you built with Python and why was it the lang of choice?

A text recognition app that I used to extract the text from a massive PDF that my college gives to students as reviewers. I chose Python because that's what came up in the Google search for "image recognition".

Django yes/no? Preferred framework?

If you enjoy using it then yes. I like Flask and Django equally.

 

Have been loosely using Python ever since the late 1990s mostly as a more powerful replacement for bash scripts and less "painful" substitute for Perl code in more complex administration and automation tasks. Started looking more into that, again, with the advent of docker containers and the fact that by now deploying more complex Python setups across various systems became considerably easier. Most of my current tasks using Python involve either runtime automation (which are dirty command-line scripts for doing obscure things in our infrastructure) or RESTful microservices (using flask or webpy). Still is fun in many situations, even though (compared to Java which we still heavily use for larger projects), some things are bit of a pain...

 

It's a fine language, but the documentation isn't on par with MSDN or MDN.

It seems to be assumed in some parts of the devops world. I use it for our CI/CD pipeline to AWS. In that sense I'd liken it more to powershell than use it for application development.

Never used Django.

 

insights.stackoverflow.com/trends?...

Python is widely used and growing - I think its a good choice to stick with this platform for a some time )
However, Im not too aware of what is going on in the community - as Moore’s law is phasing out, and we must parallelize as much computing as possible, developer-friendly concurrency model becomes important for tools that you will use, and I dont know if Python is going to go this way )

 
  1. I like python because it makes OOP easier on the ol' fingers than Java or C++. I dislike python (3.5 or higher) because the interpreter is finicky about whitespace.

  2. In the past, mostly numerical methods. Most recently, an interface to a REDCap API for a neurological research study.

  3. I would love to learn more about Django w MySQL. Their docs are nice. So, no, but on the basis of ignorance.

 
  • I prefer Flask, but I don't do to much web dev, more interested in the API part.
    For me is cleaner and easyer to maintain.

  • First of all, python works greate toghether with data science. Even if is a high level programming language, you have tools that can process your code in a very fast way. Second, you have python preinstalled on most linux distributions.

  • I like python because it does the job fast, clean and easy, no need to over complicate things.

 
 

I am flexible in Python and Django

Noor Alam.
BUET

 

Django yes/no? Preferred framework?

Have to drop this in here - it's one of Django's co-originator's talking about what he dislikes about frameworks. Including Django.

code of conduct - report abuse