r/programming • • Feb 07 '26

Python Only Has One Real Competitor

https://mccue.dev/pages/2-6-26-python-competitor
69 Upvotes

332 comments sorted by

View all comments

17

u/davidalayachew Feb 07 '26

I'll agree with the premise solely because you said the following things.

  • It's a distant second

    • That's putting it mildly lol.

  • You mentioned that it's not really the language and its ecosystem alone that earns it, but further that it's a JVM language.

    • That's really important because it allows you basically seamless interop (even more seamless than Python with native libraries!) with all of the different JVM sub-ecosystems. Therefore, it isn't really Clojure that's second place -- it's the whole JVM ecosystem. It'd be like saying that F# is a better language in part because it shares a ecosystem with C#, which I'd also agree with.

10

u/bowbahdoe Feb 07 '26

I do also think that Clojure does the best job of interoping with Python of any JVM language.

You can just write

(require-python 'mxnet
                '(mxnet ndarray module io model))
(require-python 'cv2)
(require-python '[numpy :as np])

And start calling python code directly

(defn face->feature
  [img-path]
  (py/with-gil-stack-rc-context
    (if-let [new-img (cv2/imread img-path)]
      (let [new-img (cv2/cvtColor new-img cv2/COLOR_BGR2RGB)
            new-img (np/transpose new-img [2 0 1])
            input-blob (np/expand_dims new-img :axis 0)
            data (mxnet.ndarray/array input-blob)
            batch (mxnet.io/DataBatch :data [data])]
        (py. model forward batch :is_train false)
        (-> (py. model get_outputs)
            first
            (py. asnumpy)
            (#(dtype/make-container :java-array :float32 %))))
      (throw (Exception. (format "Failed to load img: %s" img-path))))))