Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Posts by mr Tsjolder
Can anyone explain to me why my Haskell function gives rise to a type-definition error? Originally, I wrote the following function to subtract one from the first n elements in a list: dec_first :...
I have created a tag in my project, using git tag v2023 However, I forgot to commit a few changes. Now I would like to move this tag to the current point (after having committed the changes I had...
The map operation is a typical concept from the functional programming paradigm. However, side-effects are a typical example of something that does not fit functional programming well. As a resul...
I am writing a Python package where I have two classes in different files that (indirectly) depend on each other. If I wouldn't care about type-hints, there would be no problem, but unfortunately,...
Assuming that dynamicmodel and uncertainlibrary are just (nested) dictionaries and value = '["SCD"]["CL0"]' is actually supposed to be a string (note the single quotes here), your code would at...
After a few years of casually using stack-exchange sites and wandering around on coda-dict, I feel there are mainly three components to the quality of the content on each of these sites: the kno...
A few thoughts from my side (as a ML researcher, without experience in LLMs): I am not sure if it is really useful to block ChatGPT specifically. ChatGPT is only one of many LLMs out there. ...
I eventually also found out that the typing module has a global variable TYPE_CHECKING that can be used to only import during type-checking. Concretely, the following code for helpers.py seems to ...
I am working on a toy project where I have a container for which I would like to write an iterator that iterates over the values in the container. Because the values are stored in a (c-style) arra...
It seems like what you want to do can be achieved by using data.assign_coords(t=[0.123]) The error message is extremely confusing in this respect, but it seems like the new value for the coordi...
You can use the carriage return control character "\r" to return to the beginning of the line and overwrite text. When using the print function you additionally have to make sure not to write the ...
The following expression should capture the {dp|gp}/$ID part: https://www\.amazon\.com/([gd]p/[A-z0-9]{10}) A quick explanation: the \. are there to match periods only (otherwise it would ma...
I just noticed this question about data structures in the Q&A. Although algorithms and data structures are often (part of) a solution to a problem when writing software, this question is const...
Each rule in the Makefile represents a single target. This means that your first makefile has a single target: obj/library.o. I guess that if there is only one target, make assumes that this is the...
I believe one of the main strengths of Q&A websites is that they provide a more digestible alternative to dense documentation. Especially for programmers who do not yet know how to find/use th...
First of all, the standard keystroke for interrupting a CLI program would be ctrl + C or whatever the windows equivalent is. Therefore, you will get the most consistent user experience if you use ...
I used to have some testing code for mocking a simple directory structure when working with pathlib. I recently tried to run these tests to learn that some of the internals in pathlib have changed ...
Tensorflow functions should typically work on both eager and graph tensors. This means that you can just use the following implementation: def lin_to_db(x: float | tf.Tensor) -> tf.Tensor: ...
It turns out that this is exactly what autospeccing is for. Using from pathlib import Path from unittest import mock some_path = Path("/some/path/") with mock.patch("pathlib.Path.is_dir", aut...
Since pandas uses numpy for these computations under the hood, I would have suggested to use df.mean(keepdims=True), but apparently this has been explicitly disabled by pandas. However, after look...