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
Inspired by https://meta.stackoverflow.com/questions/432242, and the relevant main-space questions. I have heard that C and C++ something called the "strict aliasing rule", which means for exa...
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...
Reminder: never use sudo to run Pip. This can never properly fix a problem and only introduces serious security risks. Installing third-party packages from PyPI can run arbitrary code at install ...
My (non-Windows) operating system came with Python, but that Python didn't include Pip. I followed instructions to install Pip for the included Python, using my system's package manager. But now w...
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...
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...
Why The most important ideas behind virtual environments are: Since there is a separate site-packages, you can isolate the dependencies of your project. This is especially important for testi...
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...
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...
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...
I have multiple installations of Python on my machine. When I run Python, what determines which installation is used? How can I control this?
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...
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...
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. ...
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...
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...
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...
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...
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. ...
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 ...
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 ...
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...
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...
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 ...
- ← Previous
- 1
- 2
- 3
- 4
- Next →