• 1 Post
  • 49 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle
  • Womble@lemmy.worldtoProgramming@programming.devSelf-documenting Code
    link
    fedilink
    English
    arrow-up
    10
    arrow-down
    5
    ·
    edit-2
    11 days ago

    Good code is not “elegant” code. It’s code that is simple and unsurprising and can be easily understood by a hungover fresh graduate new hire.

    I wouldnt go that far, both elegance are simplicity are important. Sure using obvious and well known language feaures is a plus, but give me three lines that solve the problem as a graph search over 200 lines of object oriented boilerplate any day. Like most things it’s a trade-off, going too far in either direction is bad.


  • Legislators are there to directly reflect the opinions and interests of their constituents, judges are there to have expert knowledge of the law and how it applies to each case uniquely. The first needs some form of democratic mechanism to ensure that they represent people’s current opinions, the later needs a meritocratic mechanism to ensure they are experts in the correct fields.

    If judges were the only element of a court I would agree that it would be problematic to have no democratic input, but in common law systems at least that element is represented by juries who are the most powerful element of a court case as they are unchallengable arbiters of fact and drawn through sortition which is even more democratic than election.






  • I was responding to your general statement that python is slow and so there is no point in making it faster, I agree that removing the GIL wont do much to improve the execution speed for programs making heavy use of numpy or things calling outside it.

    That’s a bit suss too tbh. Did the C++ version use an existing library like Eigen too or did they implement everything from scratch?

    It was written entirely from scratch which is kind of my point, a well writen python program can outperform a naive c implementation and is vastly simpler to create.

    If you have the expertise and are willing to put in the effort you likely can squeze that extra bit of performance out by dropping to a lower level language, but for certain workloads you can get good performance out of python if you know what you are doing so calling it extremely slow and saying you have to move to another language if you care about performance is missleading.


  • Numpy is written in C.

    Python is written in C too, what’s your point? I’ve seen this argument a few times and I find it bizarre that “easily able to incorporate highly optimised Fortran and C numerical routines” is somehow portrayed as a point against python.

    Numpy is a defacto extension to the python standard that adds first class support for single type multi-dimensional arrays and functions for working on them. It is implemented in a mixture of python and c (about 60% python according to github) , interfaces with python’s c-api and links in specialist libraries for operations. You could write the same statement for parts of the python std-lib, is that also not python?

    Its hard to not understate just how much simpler development is in numpy compared to c++, in this example here the new python version was less than 50 lines and was developed in an afternoon, the c++ version was closing in on 1000 lines over 6 files.


  • Nope, if you’re working on large arrays of data you can get significant speed ups using well optimised BLAS functions that are vectorised (numpy) which beats out simply written c++ operating on each array element in turn. There’s also Numba which uses LLVM to jit compile a subset of python to get compiled performance, though I didnt go to that in this case.

    You could link the BLAS libraries to c++ but its significantly more work than just importing numpy from python.



  • Local models WOULD form the basis of FOSS AI. Supposition on my part but entirely supportable given there is already a open source model movement focus on producing local models and open source software is generally privacy focused.

    Local models ARE inherently private due to the way that no information leaves the device it is processed on.

    I know you dont want to engage with arguments and instead just wail at the latest daemon for internet points, but you can have more than one statement in a sentence without being incoherent.






  • The point you seem to be missing is that it isnt that linux is too hard for average people, it isnt id even say its easier than windows to use for people who arent deep into using windows already.

    Its that installing any os is too much for regular people and Microsoft have been fighting dirty and abusing market dominance to make sure they kill pre-installed linux machines.