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

[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

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), still what seems missing for Julia (in or out of Julia standard library):

23.2. locale — Internationalization services

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

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> (C++20) reusable thread barrier, <semaphore> (C++20)

<compare> (C++20) Three-way comparison operator support [I believe this is same as Julia’s cmp, just in operator form, and we strictly don’t need that]

<stacktrace> (C++23) Stacktrace library

Semaphore

cmp

(You could always define const ⋛ = cmp if you want a binary operator, using \gtreqless U+22DB.)

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.

6 Likes

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

Even std::make_heap - cppreference.com 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?

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.

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, for example), and Julia’s built-in packaging system makes it relatively worry-free to add a dependency on an “external” module.

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.

6 Likes

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

ChainMap is equivalent to https://github.com/invenia/LayerDicts.jl seem totally unrelated to: ANN: the implosion of ChainMap.jl

12. Data Persistence

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 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

A post was split to a new topic: Julia analogue of Python shelve module?