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‭

99 posts
75%
+4 −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 1y ago by Karl Knechtel‭

Answer
75%
+4 −0
Meta Should self-answered Q&A use separate answers for different techniques/approaches (even if there's a caveat that applies overall)?

Looking back at my own Q&A How can I build a string from smaller pieces?, the answer is incredibly long. I'm essentially showing five different ways to solve the problem - because they all exis...

2 answers  ·  posted 1y ago by Karl Knechtel‭  ·  last activity 1y ago by Lundin‭

75%
+4 −0
Q&A Understanding mutable default arguments in Python

Workarounds Avoiding mutation Because problems are only caused by actually mutating the default argument, the simplest way to avoid problems is to... not do that. Pythonic code obeys command-quer...

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

Answer
75%
+4 −0
Q&A Understanding "logical OR" and "logical AND" in programming languages

Many programming languages either have keywords like or and and used for logic, or equivalent operators such as || or && - which are referred to as "logical or" and "logical and" respective...

3 answers  ·  posted 5mo ago by Karl Knechtel‭  ·  edited 4mo ago by Andreas demands justice for humanity‭

75%
+4 −0
Meta Comparing our site scope to Stack Overflow

We've had discussions before about the site's intended scope (range of permissible topics and questions), but for new users coming from the Stack Exchange network, I think it would be useful to dra...

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

75%
+4 −0
Q&A What actually is a pytest fixture?

The term long predates Pytest and is not at all specific to Python. The idea is described on Wikipedia: In the context of software a test fixture (also called "test context") is used to set up s...

posted 7mo ago by Karl Knechtel‭

Answer
71%
+3 −0
Meta How can we grow this community?

Cite good Q&A elsewhere For example: I was saddened to realize that, as of me writing this, a question and/or answer from Software Development has never been submitted on Hacker News. The doma...

posted 2d ago by Karl Knechtel‭

Answer
71%
+3 −0
Q&A Automatically install all packages needed

A compromise exists between automatically inferring package names (unreliable and potentially dangerous) and writing out an explicit separate requirements.txt file: script-running tools such as pip...

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

Answer
71%
+3 −0
Meta Do we want MathJax?

I would support this, but only if it doesn't noticeably distract from implementing other important features. I imagine that MathJax would have a real, but niche use on Software for more theoretical...

posted 2mo ago by Karl Knechtel‭

Answer
71%
+3 −0
Q&A Simultaneous comparison in Python

Using and and or correctly The left-hand side and right-hand side of these operators should both be valid operands, which should each come from a comparison. Thus, we should repeat the comparison ...

posted 5mo ago by Karl Knechtel‭

Answer
71%
+3 −0
Q&A Understanding "de Morgan's laws"

Overview de Morgan's laws are rules of logic that allow you to transform one conditional expression into another, equivalent expression. Because (in Boolean logic) two negations cancel each other ...

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

Answer
71%
+3 −0
Q&A Understanding "de Morgan's laws"

While trying to understand logical 'or'/'and', I encountered another problem (I'm writing Python code here, but my question is about the logic, not about any given programming language). I have som...

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

71%
+3 −0
Q&A What happened, or is happening, to other parts of the standard library? Why are they going missing?

In Python 3.12, I noticed that some libraries seem to be missing or "deprecated": >>> import asynchat Traceback (most recent call last): File "<stdin>", line 1, in <module&gt...

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

71%
+3 −0
Q&A Why does `tkinter` (or `turtle`, or IDLE) seem to be missing or broken? Isn't it part of the standard library?

General This question and answer are adapted from my original write-up on Stack Overflow, which you may consult for more details. This version is crafted as to be a clear overview, without referri...

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

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

Contrary to popular belief, Pip is not part of the Python standard library - although it comes as part of a standard distribution of Python. Pip is developed and maintained by the arms-length Pytho...

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

Answer
71%
+3 −0
Q&A Understanding Virtual Environments for Python

Several times now, I've seen advice in tutorials, setup/install instructions for Python-based projects, etc. to use a virtual environment to keep things organized and make it simpler to manage the ...

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

71%
+3 −0
Q&A How can I start my Python code, from the code itself?

I have already learned how to tell the Python interpreter to run my code, but the standard approach feels a little unsatisfactory. I want the user experience to be that my program starts with the a...

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

Question python startup
71%
+3 −0
Q&A Choosing between multiple Python installations (environments) on the same computer

This answer assumes only installations of the reference "CPython" implementation, as provided by the official website at https://www.python.org. Other installations - such as those provided by th...

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

Answer
71%
+3 −0
Q&A Choosing between multiple Python installations (environments) on the same computer

I have multiple installations of Python on my machine. When I run Python, what determines which installation is used? How can I control this?

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

71%
+3 −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 12mo ago by Karl Knechtel‭  ·  edited 12mo ago by Karl Knechtel‭

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

The fundamental problem here is that it is already ambiguous where the "end" of the data in the buffer is. Strings can be empty (have zero length as reported by strlen); as such, buffer could equal...

posted 1y ago by Karl Knechtel‭

Answer
71%
+3 −0
Q&A Open file in script's own folder

Theory Relative paths are relative to the current working directory of the Python process. This can be checked from within Python using the os.getcwd function and set using the os.chdir function. ...

posted 1y ago by Karl Knechtel‭

Answer
71%
+3 −0
Q&A How to troubleshoot ModuleNotFoundError?

Root cause ModuleNotFoundError is a kind of ImportError. It occurs when Python code tries to use an absolute import, but can't find the named module - just as the name suggests. (Failed relative i...

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

Answer
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 1y ago by Karl Knechtel‭  ·  edited 1y 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 1y ago by Karl Knechtel‭  ·  last activity 1y ago by Karl Knechtel‭

Question python format output