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 Karl Knechtel
As the author, this is my defense. Design and modeling are on-topic The site topicality documentation explicitly includes "Software design, architecture, or modeling" as on topic. There doesn't s...
Background This is inspired to some extent by https://software.codidact.com/posts/289597 . I'm trying to provide a large amount of content (gradually!) that novices (mainly to Python) will find u...
Possible justifications It may make sense to use a mutable default argument in the following situations: For simplicity Consider for example an argument that should be some kind of mapping, wher...
Starting up Python There are several key ways to use the python command from the command line: python by itself starts a REPL that allows typing in and running Python code on the fly, one sta...
Python allows for operators to be overloaded (the subject of a separate future Q&A). The / operator doesn't strictly mean division in a mathematical sense; it means whatever the operands define...
This question is about the general case of subprocess-exited-with-error. It's intended to help you understand the situation if you get an error like this, and there are some common workarounds - ...
It seems fine to me to restrict new users in this way - most of them probably weren't getting anywhere near the old limits, or even the new ones, anyway. (It's unfortunately common on sites like th...
I want to make multiple comparisons at once, of the same type, in a Python program. For example, to check whether all of a certain group of strings are in a longer test string; or whether a specifi...
A handful of standard library modules either have been, or will soon be, removed from the Python standard library, as part of a general cleanup effort. These modules are seen as out of date and no ...
venv is indeed part of the standard library. However, some Linux distros modify Python to exclude some parts for various reasons, and venv might be among them. On Debian-based Linux distros you ...
I already know that the pip command might not correspond to the same Python that python runs. But in my case, it seems not to exist at all. I can't even run it as a Python module: $ python -m pip ...
I tried installing package-installation-test[1] using Pip, and it appeared to be successful. But I can't use it as advertised, either by itself or by importing it from my code: Failed attempts ...
In many other programming languages, the execution of code starts in a specifically named function (such as main) which is expected to have a specific signature, which allows that function to recei...
Whenever Python loads code from a .py file, that code gets its own namespace for global variables - so they're not truly global, but per-file values. (When you look at an imported module "from outs...
I've seen many examples of Python scripts that include a line that says: if __name__ == '__main__': Sometimes the following block contains a bunch of code, but other times it just makes a singl...
First, we need to define some semantics. While it may not matter for your actual inputs, I propose that it should be valid for the output elements - the parts of the text found outside of brackets ...
Mac/Linux In this environment, Python scripts can be given a shebang line that tells the operating system that the file is a script, and what interpreter (i.e., Python) to use for it. Because # st...
Suppose I have some variables like: >>> count = 8 >>> status = 'off' I want to combine them with some hard-coded text, to get a single string like 'I have 8 cans of Spam®; b...
Understanding distutils and setuptools: the history The short version of "why does installing Setuptools fix the problem?" is that Setuptools provides its own distutils package, overriding anythin...
This question is inspired by If I have a char array containing strings with a null byte (\0) terminating each string, how would I add another string onto the end? on Stack Overflow. Suppose I have...
The raise statement in Python accepts either an Exception class or an instance of that class. When used with a class, Python will create and raise an instance by passing no arguments to the constru...
Command-line timing Rather than using separate code for timing, I tried running the timeit module as a command-line tool. I wrote initial versions of the implementations based on the OP and hkotsu...
Sometimes code needs to assign (or otherwise use) a value that depends on some condition. The naive approach is to use explicit branching, which in Python would look like: if some_condition(): ...
Are books special? When I see a question like this, I naturally transform it into a more general question about resources. Printed books aren't necessarily the best way to learn about programming ...
I struggle to think of any use cases for merging from. Why was the merge command designed this way? The model here is that many developers on the same project are using branches to develop fea...
- ← Previous
- 1
- 2
- 3
- 4
- Next →