Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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‭

45 posts
71%
+3 −0
Meta Questions easily answered by studying a beginner-level book

There's still time This scenario is not yet a problem for this site, but we will get there, since it's a huge problem for Stack Overflow This topic should be separately addressed, too. At ti...

posted 10mo ago by Karl Knechtel‭

Answer
71%
+3 −0
Q&A How can I output / display multiple values, with controlled spacing, without building a string?

I know that I can display a single string in the terminal window like print("example") (or similarly with a string in a variable), and I know how to open text files and write to them. I also know ...

1 answer  ·  posted 10mo ago by Karl Knechtel‭  ·  last activity 10mo ago by Karl Knechtel‭

Question python format output
71%
+3 −0
Q&A How can I output / display multiple values, with controlled spacing, without building a string?

Using the write method The write method of a file offers a much more limited interface. It only accepts one argument - a string, for a file opened in text mode - and outputs just what it's given. ...

posted 10mo ago by Karl Knechtel‭  ·  edited 10mo ago by Karl Knechtel‭

Answer
71%
+3 −0
Meta Handling common wrong approaches and misguided motivations for basic technique questions

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...

1 answer  ·  posted 8mo ago by Karl Knechtel‭  ·  last activity 8mo ago by Lundin‭

70%
+5 −1
Q&A How and where does Python code start running? How can I control that?

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...

posted 29d ago by Karl Knechtel‭

Answer
66%
+2 −0
Q&A Why does `distutils` seem to be missing or broken? Isn't it part of the standard library?

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...

posted 26d ago by Karl Knechtel‭  ·  edited 26d ago by Karl Knechtel‭

Answer
66%
+2 −0
Q&A Privilege escalation from Python like from systemd

Generallly (assuming no exploit is found) it's not possible to escalate the privileges of an already running process, except via code that itself has kernel level access (running in ring 0 - this i...

posted 1mo ago by Karl Knechtel‭  ·  edited 1mo ago by Karl Knechtel‭

Answer
66%
+2 −0
Q&A How can I manage multiple consecutive strings in a buffer (and add more later)?

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...

2 answers  ·  posted 2mo ago by Karl Knechtel‭  ·  last activity 20d ago by Lundin‭

Question c string
66%
+2 −0
Q&A How can I provide additional information when raising an exception?

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...

posted 4mo ago by Karl Knechtel‭

Answer
66%
+2 −0
Code Reviews Detecting balanced parentheses in Python

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...

posted 4mo ago by Karl Knechtel‭

Answer
66%
+4 −1
Q&A Does Python have a "ternary operator" (conditional evaluation operator like "?:" in other languages)?

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(): ...

2 answers  ·  posted 6mo ago by Karl Knechtel‭  ·  last activity 6mo ago by matthewsnyder‭

Question python syntax
66%
+2 −0
Meta Should asking about book recommendations directly connected to software development be on-topic?

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 ...

posted 9mo ago by Karl Knechtel‭  ·  edited 9mo ago by Karl Knechtel‭

Answer
66%
+2 −0
Q&A Why is git merge from rather than to?

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...

posted 10mo ago by Karl Knechtel‭

Answer
66%
+4 −1
Q&A How can I build a string from smaller pieces?

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...

2 answers  ·  posted 10mo ago by Karl Knechtel‭  ·  last activity 10mo ago by Karl Knechtel‭

60%
+1 −0
Q&A Optimized representation for sets?

First store the universe of potential elements as a sequence, then encode each set as an unsigned integer interpreted as follows: if the 1s bit in binary is set (1), the set contains the 0th elemen...

posted 8mo ago by Karl Knechtel‭

Answer
60%
+1 −0
Code Reviews JSON log formatter

PEP 8 Four-space indentation is the community standard. There are many strategies for wrapping long lines; I have found that it's often best to just use temporary variables to avoid wrapping lines...

posted 4mo ago by Karl Knechtel‭

Answer
60%
+1 −0
Q&A Optimized representation for sets?

I need to do a lot of calculations involving sets. There are relatively few values in the "universe" of candidates that could appear in any of the sets, but potentially very many such sets (they mi...

1 answer  ·  posted 8mo ago by Karl Knechtel‭  ·  last activity 8mo ago by Karl Knechtel‭

60%
+1 −0
Meta How should I organize material about text encoding in Python into questions?

Here is my current thinking on the matter. Regarding questions/facets that are "two sides of the same coin" - encoding vs decoding the data, reading vs. writing files - I think they should be ...

posted 9mo ago by Karl Knechtel‭

Answer
60%
+1 −0
Q&A Why does `distutils` seem to be missing or broken? Isn't it part of the standard library?

Sometimes when I try to install a third-party library for Python, I get an error saying that either distutils, or some part of it like distutils.core or distutils.util, could not be found. It's sho...

1 answer  ·  posted 26d ago by Karl Knechtel‭  ·  last activity 26d ago by Karl Knechtel‭

50%
+0 −0
Q&A How to compress columns of dataframe by function

Conceptually, applying a function along an axis of a DataFrame (i.e., applying it to each row or column) inherently produces a Series: a two-dimensional result is collapsed to a one-dimensional res...

posted 10mo ago by Karl Knechtel‭

Answer