# What is Python (prog lang) used for?

**URL:** <https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650>\
**Category:** Factual Questions\
**Created:** [November 15, 2015, 9:32pm UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650 "2015-11-15T21:32:02Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![Melbourne](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Melbourne](https://boards.straightdope.com/u/Melbourne)\
**Post date:** [November 18, 2015, 4:58am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/21 "2015-11-18T04:58:49Z")

</div>

> [@Shagnasty](#):
>
> This article expands on what I said but you should be happy they are teaching your son using Python. Unlike some other teaching languages, Python has very real practical applications in the real world and there are even highly paid programmers and analysts whose work depends on it.
> 
> [Why We Choose Python](http://www.sixfeetup.com/blog/why-we-choose-python)

“Because it’s better than Java and PHP”

…damming with faint praise…

---

<div class="post-metadata">

**Author:** ![MrDibble](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mrdibble/32/114_2.png) [@MrDibble](https://boards.straightdope.com/u/MrDibble)\
**Post date:** [November 18, 2015, 9:26am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/22 "2015-11-18T09:26:37Z")

</div>

> [@Melbourne](#):
>
> This year I’ve given up on Python and gone back to Excel for test and measurement.

I think there’s some confusion here - you gave up on a _language_ to go back to an _application_? Those are two different categories, of course the one won’t do what the other does near as as well. Nor should it - “being a spreadsheet” is not Python’s forte. Or by Excel do you mean Excel+VB?

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [November 18, 2015, 10:15am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/23 "2015-11-18T10:15:56Z")

</div>

> [@Melbourne](#):
>
> This leads me to observe that a lot of Python work is done with Web interfaces, where the Web interface is “native” to the application. and where a spreadsheet would not be a suitable form of persistent storage.
> 
> I think that display and storage are underated aspects of language design.

There are Python frameworks like Django that allow rapid creation of high quality web services. Nothing to do with the language. It is just that Python lends itself to a lot of useful things. In the Scientific arena Python competes head to head with Matlab via numpy and scipy. Again, nothing to do with the language.

Persistent storage is an interesting one. It is a significantly more complex problem than just being able to write data to a file. Excel is about as close to the bottom of the pile as it gets. Data interchange via csv files isn’t exactly high end either. There was a whole area of research into persistent storage and language design. Languages like PS-Algol and Napier-88. It isn’t a simple problem. Type systems are complicated, and a real persistent storage abstraction needs to tie in. Sadly all we have in most areas is serialisation of objects. This is way short of what is possible.

Other than that, a lot of system just front end an SQL database, and use that for persistent storage. That isn’t language level in any meaningful sense either.

---

<div class="post-metadata">

**Author:** ![PatrickLondon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/patricklondon/32/4422_2.png) [@PatrickLondon](https://boards.straightdope.com/u/PatrickLondon)\
**Post date:** [November 18, 2015, 5:13pm UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/24 "2015-11-18T17:13:38Z")

</div>

> [@Saint\_Cad](#):
>
> In other words, what would I actually use Python for?

Is it too obvious to suggest spam?

---

<div class="post-metadata">

**Author:** ![Melbourne](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Melbourne](https://boards.straightdope.com/u/Melbourne)\
**Post date:** [November 19, 2015, 7:36am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/25 "2015-11-19T07:36:50Z")

</div>

> [@MrDibble](#):
>
> I think there’s some confusion here - you gave up on a _language_ to go back to an _application_? Those are two different categories, of course the one won’t do what the other does near as as well. Nor should it - “being a spreadsheet” is not Python’s forte. Or by Excel do you mean Excel+VB?

And here we have an example of downplaying the importance of the user interface and persistent storage in language design.

Yes, if you define “language” as divorced from interface and storage, then interface and storage are not part of language. If you define “language” as being only spoken, then what I am writing here is not “language”. If you define “language” as being non-visual, then sign-language is not language. If you think architects and designers are pretentious, then you probably don’t accept the idea of communicating using a visual design language.

You may remember that there was a significant debate about what should be included in “computer languages”. c was a language of only 32 key words that did not include any I/O at all – all that was left to the operating system to provide. Pascal, at almost the same time, was a language that included “Writeln” as part of the language definition.

You can choose to use a narrow definition of language, that doesn’t include the user and system I/O. My point is that doing so is not historically accurate, it’s intellectually limiting, and it’s a misleading way to approach language productivity.

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [November 19, 2015, 9:27am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/26 "2015-11-19T09:27:32Z")

</div>

Language in any computer sense has defined syntax, semantics, and a type system. If we take your definition of a language, the entirety of Windows is a language.

Excel is implemented in a language just as a book, a movie, ballet, music, or stage play is written in a spoken or visual language. Excel embodies a couple of languages internally, the simple expressions in cells, and VB. Visual languages exist, but have never made much progress. Simple things like DX-Explorer have a visual language. Excel doesn’t have a visual language. It has an ad hoc visual display motif. Spreadsheets themselves are a paradigm. Just like a relational database is.

Whether a language should have persistent storage or a user interface as part of its definition is an open question. Personally I would like to see persistent storage, but the problem here is that you cease to have the ability to usefully interact with other tools when you do. User interface is just too big a problem. Excel has a very primitive GUI capability. Much of its better capabilities are not part of any language, but simply bolt-on libraries. Compared to something like Mathematica it is stone age.

In many software designs the axiom is - do one thing and do it well. Excel is a very good spreadsheet. It is a dire GUI, appalling coding environment, and utterly unsuited to anything more than the most primitive of data storage applications. One of the problems I see in many of the “softer” sciences is a habit of doing everything in a spreadsheet. It ends in tears. There is no useful capability for proper software engineering. No useful version control, no test frameworks, it is impossible to collaboratively write spreadsheets. It has a type system about as primitive as C. Most people don’t even attempt to comment or document what they have created. Maintenance is close to impossible by anyone other than the author. And so it goes. In the sense of being a language for software engineering, Excel is a non-starter. As a tool for science it is desperately flawed.

There have been very interesting integrated systems. Probably the most well known is Smalltalk. But there have been others. Mesa/Cedar, also from Xerox PARC, the various Lisp Machines, and some of the persistent environments. But technology has kept moving too fast, and the potential that exists (for instance in ubiquitous network connectivity and high powered self contained portable devices) makes it hard to design a fully integrated environment that isn’t obsolete before even a prototype is written.

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [November 19, 2015, 10:13am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/27 "2015-11-19T10:13:27Z")

</div>

[Excel books+formulas are Turing Complete, however](http://www.felienne.com/archives/2974)

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [November 19, 2015, 10:39am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/28 "2015-11-19T10:39:29Z")

</div>

> [@Jragon](#):
>
> [Excel books+formulas are Turing Complete, however](http://www.felienne.com/archives/2974)

Only if you have infinite storage (tape).

Excel is limited to 16384 rows. Pedantically no extant computer as really Turing complete. But close enough for folk music.

Then again, a Turing Machine is Turing complete. Not the best programming environment, but there it is.

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [November 19, 2015, 12:10pm UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/29 "2015-11-19T12:10:57Z")

</div>

> [@Melbourne](#):
>
> This year I’ve given up on Python and gone back to Excel for test and measurement. Python is cross-platform and an OK language for writing scripts in, but Excel has a native GUI and native persistent storage, and exposes the native persistent storage in the native GUI.
> 
> This leads me to observe that a lot of Python work is done with Web interfaces, where the Web interface is “native” to the application. and where a spreadsheet would not be a suitable form of persistent storage.
> 
> I think that display and storage are underated aspects of language design.

I mean, this is fine until you’re working with terabytes or petabytes of data, or even gigabytes over maybe 2. I agree that Excel has some serious benefits if you just need some processing and organization over small sets of test data, I used it for undergrad physics labs despite knowing numpy pretty well by that point. But it becomes progressively more unwieldy as your need for analysis becomes more complex or the size of your data becomes larger.

(And to be fair, even numpy+pandas isn’t exactly a shining star of performance when dealing with big globs of data or complicated processing schemes, but it’s at least reasonably functional and often can be optimized via Cython or whatever else to be performant enough; unlike Excel which just utterly degenerates in that case)

---

<div class="post-metadata">

**Author:** ![MrDibble](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mrdibble/32/114_2.png) [@MrDibble](https://boards.straightdope.com/u/MrDibble)\
**Post date:** [November 20, 2015, 9:34am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/30 "2015-11-20T09:34:11Z")

</div>

> [@Melbourne](#):
>
> You can choose to use a narrow definition of language, that doesn’t include the user and system I/O.

I’m happy with a broad definition of language - I’m still not seeing one where “Excel” is a language, though.

---

<div class="post-metadata">

**Author:** ![Melbourne](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Melbourne](https://boards.straightdope.com/u/Melbourne)\
**Post date:** [November 22, 2015, 12:39am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/31 "2015-11-22T00:39:26Z")

</div>

> [@Francis\_Vaughan](#):
>
> Only if you have infinite storage (tape).
> 
> Excel is limited to 16384 rows. Pedantically no extant computer as really Turing complete. But close enough for folk music.
> 
> Then again, a Turing Machine is Turing complete. Not the best programming environment, but there it is.

Pedantically, of course, standard C is not Turing complete. Behaviour is undefined unless you have infinite stack space.

And the relation to Python is that common-or-gardern variety Pythons use the C stack and aren’t Turing complete either 🙂

…Although I’ve never needed to use NumPy, I have done optimisation problems in extended Excel – using Excel extensions written in C. I wouldn’t rate “ability to interface with code written in another language” as a reason to choose between any of the coding languages I use. But in answer to the OP:

One of the early, original use-cases for Python was for scripting mathematical calculations written in another language, on a platform that did not support Excel, before Open Office was any good at all.

Excel itself offers a highly productive GUI and a highly productive coding environment. It is difficult to give a generous interpretation to comments to the contrary.

Excel is/was a natural choice for processing 2D (and, at a pinch 3D, (and if required, nD))) Arrays of Numbers, which have a clear natural representation and what was, 20 years ago, a very clear, natural way of dealing with arrays as objects, and arrays one element at a time.

Compared to VBA/Excel, Python specifically benefits from language support for Functional Programming, which, amongst other things, offers a much improved, superior, clear, natural way of dealing with arrays of data.

Coupling the two – the spreadsheet and functional programming – would seem a natural winner, and at least one version of OO Calc now has support for Python. It’s not suitable for what I’m doing, but particularly given the poor support for VBA in OO, I wouldn’t be surprised if some of the financial calculations migrated to Python over the next couple of years.

---

<div class="post-metadata">

**Author:** ![Stealth\_Potato](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Stealth\_Potato](https://boards.straightdope.com/u/Stealth_Potato)\
**Post date:** [November 23, 2015, 3:09am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/32 "2015-11-23T03:09:59Z")

</div>

> [@leahcim](#):
>
> In terms of modern languages, this is the kind of thing that [Rust](https://www.rust-lang.org/) is for. Deterministic memory control (e.g… no garbage collection), but with more modern language features through zero- or low-cost abstractions.
> 
> The language was specifically developed by Mozilla for a high-performance rendering engine, but without the possibility for the kind of memory errors that are possible in C.

Just chiming in to add a +1 for Rust! 😃 I’ve been a sufferer of C++ Stockholm Syndrome for a decade and a half, and Rust is the language that has charmed me into ditching C++ and never looking back.

Incidentally, it has _also_ kind of been the last nail in Python’s coffin for me. For several years I was basically a full-time Python developer, and while it was always a language I kind of liked, those years of experience led me to an inescapable conclusion: Python (and more generally any dynamically typed language) is not suitable for large projects. Once you get past ten KLOCs or so, the complexity incurred just becomes too great; static analysis is all but impossible, and debugging is an unlocalizable nightmare.

I still used Python for small tasks though – small applications, glue code, shell scripts, that sort of thing. But once I started learning Rust, I realized that it gave me the only benefits of Python that I cared about – abstraction, expressiveness, and terseness – with none of the drawbacks of not having a type system. So now I’m happily Python-free as well.

(I still have to use C at work though. :p)

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [November 23, 2015, 3:22am UTC](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650/33 "2015-11-23T03:22:06Z")

</div>

> [@Stealth\_Potato](#):
>
> Just chiming in to add a +1 for Rust! 😃 I’ve been a sufferer of C++ Stockholm Syndrome for a decade and a half, and Rust is the language that has charmed me into ditching C++ and never looking back.
> 
> Incidentally, it has _also_ kind of been the last nail in Python’s coffin for me. For several years I was basically a full-time Python developer, and while it was always a language I kind of liked, those years of experience led me to an inescapable conclusion: Python (and more generally any dynamically typed language) is not suitable for large projects. Once you get past ten KLOCs or so, the complexity incurred just becomes too great; static analysis is all but impossible, and debugging is an unlocalizable nightmare.
> 
> I still used Python for small tasks though – small applications, glue code, shell scripts, that sort of thing. But once I started learning Rust, I realized that it gave me the only benefits of Python that I cared about – abstraction, expressiveness, and terseness – with none of the drawbacks of not having a type system. So now I’m happily Python-free as well.
> 
> (I still have to use C at work though. :p)

I’ve actually been thinking of starting a Rust thread. It’s become my main development language. It has some problems (trait bound-splosion, for instance), but for the most part it marries just the right amount of explicitness with the right amount of boilerplate.

[Previous page](https://boards.straightdope.com/t/what-is-python-prog-lang-used-for/737650.md?page=1)
