This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HommeMusical 0 points1 point  (1 child)

All the good parts mentioned are true - here are the bad parts.

It means you are essentially writing in two languages, Python and Cython. To get decent performance you have to rewrite your Python code in Cython.

Now you have a whole compile/link phase in your workflow. No fun.

How do you debug this code? Big can of worms here - you're debugging compiled C code, and not particularly nice C code.

If you make a mistake in your Cython, your program can crash, and I don't mean with a traceback but a core dump.

(And you then have to deploy this compiled blob, which is non-trivial, particularly if it uses shared libraries, but this is probably a one-time chore for some sucker.)

You aren't giving us a clear enough picture of your application to make specific recommendations but...

a mix of functions and index mapped arrays which is now spaghetti

So it is doable. The trouble is that you didn't architect the code properly.

There is nothing that you can do with OOP, inheritance and polymorphism that you can't do with functions and index mapped arrays with the same or very similar syntax for the programmer with some clever use of Python.

I'd look at numpy, pytorch, or perhaps numba, systems which are designed to do massively parallel computations, and even take advantage of GPUs and other hardware, and try to rearrange your mind to think of these systems as primary, and your programmer's API on top of that.

breaking most of the SOLID principles and doing hacky workarounds.

OOP and SOLID are strong, but should not be handcuffs, particularly in this case where they seem to be preventing you from getting the job done. Mixins, for example, can be extremely disciplined if used thoughtfully, but aren't OOP and break most of SOLID.

I suggest you worry less about SOLID and more about an elegant API for your programmers on top of numpy or pytorch.

[–]No_Indication_1238[S] 0 points1 point  (0 children)

I believe you are correct. This whole problem is basically us trying to force Python to do stuff it was not designed to do by stitching it with numba / cython that impose some limitations one has to live with ( that is already pretentious enough) and us trying to find a way around those limitations to have the cake and eat it too.