# How does Julia stack up to Python, its and e.g. C++ standard library?

**URL:** <https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455>\
**Category:** General Usage\
**Tags:** python, community\
**Created:** [September 20, 2021, 11:59am UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455 "2021-09-20T11:59:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 20, 2021, 11:59am UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455/1 "2021-09-20T11:59:25Z")

</div>

[EDIT: I answered my own question in a comment below, the Python _standard library_ doesn’t seem to have anything important for general programming missing _in the Julia ecosystem_. If you can think on an exception, please comment.]

Julia supports all the same hardware and operating systems Python does _officially_ support (e.g. Python has additionally “best effort support” for Android, and s390x). [Supported platforms and architectures — Unofficial Python Development (Victor's notes) documentation](https://pythondev.readthedocs.io/platforms.html)

Python’s standard library is about the most extensive one I can think of, and well you can use all of it (and Python’s external libraries) through PyCall.jl, but I’m curious what they might have that we would want supported natively.

I’m only concerned with modern stuff that needs supporting, file formats and encodings, such as UTF-8 (e.g. not [`sunau` — Read and write Sun AU files](https://python.readthedocs.io/en/stable/library/sunau.html)), still what seems missing for Julia (in or out of Julia standard library):

[23.2. `locale` — Internationalization services](https://python.readthedocs.io/en/stable/library/locale.html)

Julia has packages for audio (and video), I’m not sure all platforms are supported, nor e.g. platform-specific stuff like:

- [34.2. `msvcrt` — Useful routines from the MS VC++ runtime](https://python.readthedocs.io/en/stable/library/msvcrt.html)
- [34.3. `winreg` — Windows registry access](https://python.readthedocs.io/en/stable/library/winreg.html)
- [34.4. `winsound` — Sound-playing interface for Windows](https://python.readthedocs.io/en/stable/library/winsound.html)

I believe Julia has everything that C standard library supplies built-in, and most or all that C++ has built-in or available in packages. It’s not important that Julia has everything C++ (or Python) has _in its standard library_, because for C++ it’s about cross-compiler support. It’s about having the same capabilities somewhere. My pet peeve is Python has ordered dicts in its standard library (they changed from unordered), otherwise I believe Julia has all the same data structures available as it and C++ have, it’s just e.g. that one comes from a package OrderedCollections.jl.

Most of the stuff C++ has that Julia may not have involves some fairly low-level support, e.g. Thread support library:

\<[barrier](https://en.cppreference.com/w/cpp/thread/barrier)\> (C++20) reusable thread barrier, \<[semaphore](https://en.cppreference.com/w/cpp/header/semaphore)\> (C++20)

\<[compare](https://en.cppreference.com/w/cpp/header/compare)\> (C++20) [Three-way comparison operator](https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison) support [I believe this is same as Julia’s cmp, just in operator form, and we strictly don’t need that]

\<[stacktrace](https://en.cppreference.com/w/cpp/header/stacktrace)\> (C++23) [Stacktrace](https://en.cppreference.com/w/cpp/utility/basic_stacktrace) library

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 20, 2021, 12:09pm UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455/2 "2021-09-20T12:09:25Z")

</div>

> [@Palli](#):
>
> \<[semaphore](https://en.cppreference.com/w/cpp/header/semaphore)\> (C++20)

[`Semaphore`](https://docs.julialang.org/en/v1/base/parallel/#Base.Semaphore)

> [@Palli](#):
>
> \<[compare](https://en.cppreference.com/w/cpp/header/compare)\> (C++20) [Three-way comparison operator](https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison) support

[`cmp`](https://docs.julialang.org/en/v1/base/math/#Base.cmp)

(You could always define `const ⋛ = cmp` if you want a binary operator, using `\gtreqless` [U+22DB](https://www.compart.com/en/unicode/U+22DB).)

> [@Palli](#):
>
> \<[stacktrace](https://en.cppreference.com/w/cpp/header/stacktrace)\> (C++23) [Stacktrace](https://en.cppreference.com/w/cpp/utility/basic_stacktrace) library

[https://docs.julialang.org/en/v1/base/stacktraces/](https://docs.julialang.org/en/v1/base/stacktraces/)

I’m not sure that such a general discussion topic is that useful, however — if you want to compare a _specific_ function/type/module in Julia to its counterpart in C++/Python, or ask about a _specific_ feature that seems to have no counterpart, it would be better to split that discussion into a separate thread.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 20, 2021, 12:30pm UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455/3 "2021-09-20T12:30:26Z")

</div>

I could move this to the Community category. I’m trying to get at if there’s a perception we’re behind. I realize most Python users don’t use Python just for the standard library, but they could compare to ours and think something missing, so I want to map the most important areas, _and where the substitutes are_.

Most important is that we have all the data structures, and I just realized Python has one more we don’t (in the standard library that is, is in DataStructures.jl):

[8.5. `heapq` — Heap queue algorithm](https://python.readthedocs.io/en/stable/library/heapq.html)

Even [std::make\_heap - cppreference.com](https://en.cppreference.com/w/cpp/algorithm/make_heap) changed in C++20.

> `const ⋛ = cmp`

Neat, I would not know what that is if I would see this operator in code… I could get used to it, should it be defined, in the standard library? Or what else could it mean?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 20, 2021, 12:37pm UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455/4 "2021-09-20T12:37:56Z")

</div>

> [@Palli](#):
>
> I could move this to the Community category. I’m trying to get at if there’s a perception we’re behind. I realize most Python users don’t use Python just for the standard library, but they could compare to ours and think something missing, so I want to map the most important areas, _and where the substitutes are_ .

It’s not a question of category, it’s that “how do these 10,000 functions compare to Julia’s” is probably _too broad_ for a productive discussion.

> [@Palli](#):
>
> I just realized Python has one more we don’t (in the standard library that is, is in DataStructures.jl): `heapq` — Heap queue algorithm

In Julia the standard library is not as privileged as it is in Python (where the standard library is mostly not implemented in Python — `heapq` needed to be [implemented in C](https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Modules/_heapqmodule.c), for example), and Julia’s built-in packaging system makes it relatively worry-free to add a dependency on an “external” module.

> [@Palli](#):
>
> should [`⋛`] be defined, in the standard library?

No, I really don’t see the need for a binary operator here — `cmp(a, b)` seems clear and sufficient. I just wanted to point out that if you are feeling “operator envy” for `<=>`, Unicode provides a better one and Julia supports it.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 20, 2021, 1:23pm UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455/5 "2021-09-20T13:23:14Z")

</div>

To answer my own question partially (for `collections` in Python first, i.e. data structures, everything from it seems covered while I didn’t explore the User\* wrappers):

`Counter` seems to be countmap in StatsBase.jl (I would not have thought of looking there): [containers - Is there a Counter object in Julia? - Stack Overflow](https://stackoverflow.com/questions/42080575/is-there-a-counter-object-in-julia)

`ChainMap` is equivalent to [https://github.com/invenia/LayerDicts.jl](https://github.com/invenia/LayerDicts.jl) seem totally unrelated to: [ANN: the implosion of ChainMap.jl](https://discourse.julialang.org/t/ann-the-implosion-of-chainmap-jl/1995)

[12. Data Persistence](https://python.readthedocs.io/en/stable/library/persistence.html)

is of course very important, from that part of Python, we do have something equivalent to `pickle` (also actually for JSON), but it’s a bit of a can of worms (in any language), just know possible.

Even `dbm` seems covered with GDBM.jl (not registered so, `pkg> add https://github.com/BenLauwens/GDBM.jl`)

They have `argparse`, we have several such, maybe eventually some package should end up being stdlib eventually.

They have xml, json, even telnetlib and email handling (even smptd, seems very odd to have an email server in your standard library). Nothing that I don’t know to be covered n Julia, or irrelevant, while I’ve not seen smptd in Julia…

They don’t only have a library, also some frameworks/GUI stuff [IDLE](https://python.readthedocs.io/en/stable/library/idle.html) and tkinter. I believe all the same GUI stuff is covered in Julia packages, or at least the most important GUI frameworks _no less supported than the Python standard library_.

Luxor.jl equivalent to: [24.1. `turtle` — Turtle graphics](https://python.readthedocs.io/en/stable/library/turtle.html)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 20, 2021, 2:44pm UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455/6 "2021-09-20T14:44:00Z")

</div>

A post was split to a new topic: [Julia analogue of Python `shelve` module?](https://discourse.julialang.org/t/julia-analogue-of-python-shelve-module/68467)
