Is Python the Future of Programming?
m.slashdot.org
m.slashdot.org
For programs less than 500 lines, I have no issues with Python, but it feels to me like Python just isn’t suited for large-scale programming in the way C#, Java, Go, or Rust are.
If you expose everything, someone will write code that depends against it and make it harder for you to improve or change it in the future. Tossing in roadblocks helps guide users to the better long-term path.
It doesn't really matter for small teams, but it's essential for large ones without aggressive (and difficult) enforcement of contract between team members.
`foo.__a` accessible only inside `Foo`
I think it works.
It's not all that inaccessible. Try:
class C:
def __init__(self):
self.__private = 'Is it private?'
c = C()
c._C__private
Double underscore names aren't so much about access control (because access control isn't strongly enforced) as about limiting name collisions (by including the class name in the underlying field name).> It doesn't really matter for small teams
Doesn't even have to be your team. We encountered this by way of a major library, celery.
I forget all the details, but celery was importing something else (name started with a "k", I think), and that was importing an underscore-prefixed function from uuid. Somewhere between python versions 2.7.8 and 2.7.13, the implementation of uuid changed and that import failed.
The real productivity win here is that you can hire a bunch of junior engineers out of university for "cheap" that "know" python. After all, why would you train a new hire in a different language for a few weeks or months when that would take a huge amount of time in startup-verse? /s?
It's important to note that the largest push for things like type checking and access control in dynamically-typed, shared-mutable-everything languages are coming from the companies that built themselves quickly on these languages and now need to deal with scaling.
It’s not correctness it’s communication. A type checker will save you from small errors but well written and easily understandable code will save you from a lot more.
Not saying readability is harder in c# java go or rust just that the type system doesn’t help with it that much.
I don't think python is good for large systems, but for companies, it's hard to get to that point without something that you can prototype quickly with.
I'm sure a more competent typist wouldn't have these issues but it trips me up constantly just in dev. Tests protect this from hitting prod.
The extra refactor support just isn't there compared to java.
There is type hinting.
> And what about lack of access modifiers?
There is @property decorators
Python 2 and 3 both have AOT static type checkers available (this is essentially “pre-compile-time”). Presumably those for whom not having this would be a problem use it.
> And what about lack of access modifiers?
It's an issue, but use of the conventional underscore prefix makes mitigation via code review fairly simple.
Not as good as a real static type system with compiler, but still helpful for documenting the code and tools for static code analysis.
replacing BASIC(i.e. good for beginners)
replacing Java in colleges for intro to programming
replacing matlab(ipython jupyter)
replacing R for ML and big data
great for web scraping
replacing Perl and probably shell scripts for CLI scripting.
strong backend framework candidates such as flask and django comparing to php/javascript frameworks too.
micropython runs on resource constrained systems so it can replace Lua there.
C friendly so you can optimize performance bottleneck when there are any.
The only missing area I can see, is that it is not designed for html/css/js frontend, so you have to use javascript there.yes, Python could be the future of programming.
Java is never going to go away, but let's hope Scala becomes more popular. Neither is C#.
I'm not really sure where Go fits into the picture.
What Python is really good at, though, is gluing together/scripting C/C++ code. I've had a lot of success in my career starting a project in Python, and then dropping down to C or C++ for the high performance bits. As an example, I worked on a software-defined radio project with some errr... special requirements. All of the modulators etc were all written in C, and the bitstream generation/manipulation was done in Python. There was also a bunch of numerical processing bits (solving diff eqs with RK4) written in C++, parameterized by Python. The net result was that we could use a Python REPL to experiment and script the system, while handily using all of our CPU cores to their maximum capacity.
I introduced my ex to it for her dissertation in astro-physics. It took her under a week to mainly self-learn and start writing scripts with numpy and matplotlib, and it was her first language. The code wasn't good by professional standards, but it did the job. I cannot think of any programming/scripting language which can be learned by someone with no previous programming experience in under a week at a level where it can be used in a masters dissertation.
I don't understand where this nonsense is coming from. Probably ignorance? You might not know too much about it to understand how huge and complex Python is.
Every language will get more complex as you dig into it, but most people don't need to go beyond the surface.
Nowadays, teachers have to start with generators and yield even for beginners, because most of the things are generators in Python3, which is not a trivial concept to understand when you have no programming background.
I can have an intern up and programming basic Python in about 3 days from nothing. I have run this experiment multiple times with teenagers.
The nice part about Python is that I can gradually introduce them to new features as they hit the problems the features are meant to solve.
And, I WILL argue that Python's syntax is easier to keep in your brain. Somewhere on HN there was an article showing the grammars of various programming languages as connected graphs, Python was quite obviously simpler than just about everything else.
Or to put it another way its a language you can do a lot with without caring too much about details.
Or to put it another way still you can go a long way with Python, Stack Overflow, and a bit of copy and paste.
I think it's more likely to continue to be the future of glue languages.
Many problems can be solved in Python directly and when they can't you can often call out to something to do the heavy lifting.
For that I've found it absolutely excels.
If there's a bunch of languages that meet the baseline functionality, why not choose the most ergonomic of the bunch?
This is whether the project is for the web, desktop, microcontrollers, CLI, whatever. Python might not be perfect for any of these things, but it's great for all of them. I need to try to write a kernel or something.
[1]: This is the finished product, by the way: https://gitlab.com/stavros/caduceus
Does anyone here have a preference for using Python to tackle concurrency-related issues? If yes, I'd love to hear your thoughts on the matter.
For I/O bound programs, you can use threading (in stdlib). For CPU bound, you can use multiprocessing (also in stdlib). But these have huge overhead, (e.g starting a Python thread costs 32kb memory minimum.) and there are multiple solutions in the stdlib like ThreadPoolExecutor and ProcessPoolExecutor in concurrent.futures beside the threading and multiprocessing modules...
If you want to write async code, there is tornado with callbacks, tornado with the new async stuff, asyncio (tulip for Python2), the new async/await from 3.5 which is very immature. The async part of the ecosystem is like a totally separate whole new world, you can't really mix and match or pick parts from the other, however, there are brave folks like Andrew Godwin how tries to make Django async with not moderate success.
For web frameworks, there are a ton of servers which might fit you, but they are mostly very complex to set up or reason about like greenlets, pre-forked web servers and stuff.
I have 5 years experience with Python, using it every day and once I tried to write a custom SSH server and it took 1-2 weeks to grasp Tornado fully, then I tried the same with Go and WITH LEARNING THE LANGUAGE itself, it took me about 2 weekends and my server was up and running!
TL;DR: You can write concurrent code with Python but it's a mess and you will probably have a hard time.
Perhaps developments in gradual typing will allow for the benefits of quick and experimental development (scripting) that can later be calcified into a sturdy fully-typed program with higher performance (through optimized AOT compilation).
[0] https://instagram-engineering.com/dismissing-python-garbage-...
Without it, people would likely have built the same memory-hungry, slow, and bloated software, but in C++ with all its added risks, lessened portability, and none of its advantages (except maybe better start-up times). There are more problems that need fixing, but Java at least solved some of them.
Edit: Java, and other languages and systems like it, really. Java had the advantage that it was familiar to C++ programmers.
1) Deep learning / data science works really well in Python
2) Lambda functions are really great in Python... maybe people will choose to write servers out of Lambda functions instead of writing high performance servers in Go - who knows?
Those are big areas, but still a small percentage of all programming work falls into those two categories.
Hah, if you had told anyone that five years ago they would have been very confused. "What are you talking about? Lambdas in Python are horribly neutered..."
Back to what you actually meant, I think that lambda functions will get simpler to use in every language, and I think JS will extend a lead there even though I prefer Python as a language.
I should get my "microservices built out of spreadsheets" project (https://6gu.nz) onto AWS Lambda to get in on the zeitgeist though, put a horse in the race. And then somehow get deep learning (and the blockchain...) in there to really cash in on the bandwagon trends.
Python is an imperative language by nature, and lamdba is very uncomfortable to use for anything than a simple expression. You can use functional elements up to a certain degree, but it will be a pain if you try to force it to be a functional language; you simply can't go very far with it.
« I certainly didn't set out to create a language that was intended for mass consumption » [Guido van Rossum] explains.
As early as 1999 he was one of the authors of the "Computer Programming for Everybody" DARPA funding proposal, which was supposed to be based on Python.
But the nature of the language, its simplicity, its indenting style, its readability, obviously yes. Those were big improvements on the C language it was inspired from.
I don't think python will survive its lack of performance, although I really wish it would.
Lua is nice in that it's easy to embed into existing projects, and has an established userbase in game modding communities (Garry's Mod, Minecraft computer mods).
At some stage I will have to get to grips with Lua (Mediawki) but I believe your comment is completely arse about face. No, I wont give any more justification than my assertion.
Not exactly something I would recommend ...
Brainfuck is simple, but not simple to learn to do useful things in with.
But some people had success nevertheless: http://droettboom.com/blog/2018/04/04/python-in-the-browser/
At least not if I have anything to say about it! Lol