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.

Activity for Karl Knechtel‭

Type On... Excerpt Status Date
Question Installing packages for, and using them with, a specific Python installation
I have multiple installations of Python on my machine. I already know how to choose one to use to run for my code - and therefore, I could also solve the problem for third-party application code. However, almost all of the third-party code I work with is libraries, not applications. When I use Pip...
(more)
6 months ago
Edit Post #291674 Initial revision 6 months ago
Answer A: How is this code "dividing" by a string?
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 it to mean - but we may call the operation "division" regardless. (Specifically, we say "true division" t...
(more)
6 months ago
Edit Post #291667 Post edited:
copyedit for conciseness, clarity and correct use of terminology; include an explicit example instead of only citing an error message; improve title
7 months ago
Comment Post #291611 Now that I've read the self-answer, the intended scope of the question is clearer to me. I might propose an edit later.
(more)
7 months ago
Comment Post #291618 I understand Pyenv as a tool for *creating or setting up* Python environments, rather than choosing between them. Have I overlooked something? I do have an upcoming question planned about venvs generally (an overview of what they are and why someone might want to use one); would information about Pye...
(more)
7 months ago
Suggested Edit Post #291667 Suggested edit:
copyedit for conciseness, clarity and correct use of terminology; include an explicit example instead of only citing an error message; improve title
(more)
helpful 7 months ago
Comment Post #291616 This is meant as part of a series of upcoming canonical Q&As to cover: * choosing which installation Pip uses * why one might want separate Python installations at all * how and why to use virtual environments I prioritized this set of questions because it provides background material so ...
(more)
7 months ago
Edit Post #291618 Post edited:
Demote a parenthetical to a footnote; renumber other footnotes
7 months ago
Edit Post #291618 Initial revision 7 months ago
Answer 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 the Microsoft Store or by Anaconda, or alternate implementations such as PyPy or IronPython - may introd...
(more)
7 months ago
Edit Post #291616 Initial revision 7 months ago
Question 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?
(more)
7 months ago
Comment Post #291611 In fact, this is **not** necessary [since Python 3.3](https://peps.python.org/pep-0420/), although this particular piece of misinformation has proven very persistent. In contemporary Python, recognition of "packages" is automatic. Adding an `__init__.py` file simply distinguishes a "regular package" ...
(more)
7 months ago
Comment Post #291611 BTW, I think I have an old post on the site Meta where I laid out some possible future import Q&As. Seems like a good time for both of us to revisit that.
(more)
7 months ago
Comment Post #291611 It's important to note here that the term "package" is overloaded here. For lack of better disambiguation: a *distribution* package is what you create by having a `setup.py` and/or `pyproject.toml` file, using a build backend such as Setuptools to create a "wheel" and/or "sdist", and optionally publi...
(more)
7 months ago
Comment Post #291556 If anything, I'd say "locked" sounds more final than "closed". Stack Exchange experimented with this in the past: they changed "closed" to "on hold". It didn't seem to accomplish anything on balance; it seems to have been only marginally friendlier, but also correspondingly more confusing. The cha...
(more)
7 months ago
Comment Post #291557 @#8176 I think part of the issue is with describing such feedback as "private". Many people feel strongly - and it's not hard to see why - that comments made to new users ought to be open for review by others. Another thing I've noted about this topic in the past is that the level of concern depen...
(more)
7 months ago
Comment Post #291557 The closed status for questions is not normally thought of as a "space" at all, but treating it this way does make a certain amount of sense. It would be nice if there were an *actual* "workshop space", possibly. My previous proposal has been to use a separate category, with the ability to *move* que...
(more)
7 months ago
Edit Post #291341 Post edited:
fix code typo - `setup` was in a sub-package before Setuptools promoted it
8 months ago
Edit Post #291341 Initial revision 8 months ago
Answer 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 anything the standard library might or might not have. When you `import setuptools` explicitly, it furtherm...
(more)
8 months ago
Edit Post #291340 Initial revision 8 months ago
Question 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 shown as a `ModuleNotFoundError`, so presumably it's coming from Python when it tries to run a `setup...
(more)
8 months ago
Comment Post #291323 I agree, at least superficially. When I started writing I had it in mind that "running" the script as an executable is the same sort of thing as invoking Python to run it (since it's still asking a Python runtime to evaluate the code, just the other way around). But looking at it now - especially giv...
(more)
8 months ago
Edit Post #291323 Initial revision 8 months ago
Answer 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 statement at a time. `python myscript.py` runs the code in `myscript.py`, assuming it's in the cur...
(more)
8 months ago
Comment Post #291322 Reference questions on Stack Overflow that inspired this question: * [Why do people write `#!/usr/bin/env python` on the first line of a Python script?](//stackoverflow.com/q/2429511) * [How do I make a python script executable?](//stackoverflow.com/q/27494758) * [`./xx.py: line 1: import: command...
(more)
8 months ago
Comment Post #291322 This question is intended as a canonical that gathers the important, overlapping ideas from several Stack Overflow questions. The goal is to create a clear overview of Python's model for starting the execution of code. The question is notably **not** about: * `import`ing code (except to the ext...
(more)
8 months ago
Edit Post #291322 Initial revision 8 months ago
Question How and where does Python code start running? How can I control that?
Suppose I have some code in a file `myscript.py` like: ``` def myfunction(): print("Test") ``` What steps do I need to take in order to make `myfunction` run? That is to say: how do I get Python to run `myscript.py`; and from there, how do I choose `myfunction` as the starting point for ...
(more)
8 months ago
Comment Post #291286 What I meant was that I assume that systemd already has kernel level access and therefore doesn't have to do anything special in order to escalate other processes. But thinking about it further, that doesn't sound right - far too easily exploitable.
(more)
8 months ago
Edit Post #291286 Post edited:
misc typos
8 months ago
Edit Post #291286 Initial revision 8 months ago
Answer 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 is presumably how `systemd` is able to do it). But from your own Python program running in user-land (as ...
(more)
8 months ago
Comment Post #291265 There seem to be many separate questions here. Please start by trying to make functions to implement the *individual* rules that you have in mind, and testing them. Then, the requirements for those rules need to be clearer for anyone to be able to help with them. For example, how should we know which...
(more)
8 months ago
Comment Post #291089 My take is that it failed partly because they lost interest, but mostly because the staff are so far out of touch with the community that they didn't properly understand what they were proposing to implement nor why it would be helpful. So, *the staff conception* of the idea was fundamentally flawed,...
(more)
9 months ago
Comment Post #291132 Well, I think that we accept *library and tool* recommendations, but not recommendations for software that would be targeted at end users. :) There has been a fair amount of discussion on Stack Overflow meta recently about whether people are being too strict or pedantic in excluding those sorts of qu...
(more)
9 months ago
Comment Post #291125 Even if you are not confident in your findings below the line, they certainly come across as a sincere attempt to answer the question above the line. It should be posted as an answer instead. This is a [perfectly acceptable and encouraged](https://meta.codidact.com/posts/290638) use of the site softw...
(more)
9 months ago
Comment Post #291068 > if this place is intended to be basically a wiki but in QA format, I think a lot of help/onboarding parts need a big rewrite. You're absolutely right to be concerned, IMO. This is exactly the sort of issue that Codidact sought to address, and found fault with in SO, back at the time. However, I ...
(more)
9 months ago
Comment Post #291068 I'm inclined to agree. Just as we don't treat the OP as special with regard to "accepting" answers (a "worked for" reaction can be applied by anyone), I would prefer that the original author of a question (or answer!) is credited in proportion to the work (both quantity and quality) done on that post...
(more)
9 months ago
Comment Post #291089 > So the question is really what to do with those naive newbies. Let them be naive, and work around them? Or have them go away and come back when they get it? I mean obviously you're saying the second, I'm saying the first, but the site collectively has to settle on one and make it clear. Ideally,...
(more)
9 months ago
Comment Post #291132 A question like this necessarily solicits either speculation or personal experience, in a way that was already found on Stack Overflow not to work well. I strongly feel that this is not something particular to Stack Overflow culture, but a consequence of the true nature of a technical Q&A site. The p...
(more)
9 months ago
Comment Post #291112 I'm afraid I don't follow. With `strcpy` or `memcpy`, it's still necessary to verify that the buffer has enough room, and it comes across to me that this is not any less work or harder to overlook. I'm familiar with your previous Q&A and I have to admit I didn't find it very convincing. That said,...
(more)
9 months ago
Comment Post #291068 I agree that experts [should be proactively asking](https://meta.stackoverflow.com/questions/426205/) questions that are of interest to beginners (and as I already pointed out, you've had the same idea on Linux Systems). Regarding re-asking poorly asked questions, I think you should ask a separate...
(more)
9 months ago
Comment Post #291089 Regarding workable standardized reasons to close a question, I agree that the breakdown on Stack Overflow is somewhat awkward. I've written about other possibilities on our Meta before (it may have been the overall Meta), but it won't be easy for me to find at the moment.
(more)
9 months ago
Comment Post #291089 Abuse and misunderstanding (and everything in between) of close reasons is always a concern, regardless of what the stated reasons are. But in all seriousness, a very large fraction of questions that trigger the "stupid question" emotional response *really are* overly broad, and that broadness is ver...
(more)
9 months ago
Comment Post #291089 To understand "you don't get an answer, written for you, directly to your question" as punitive, one must first presume that the opposite is a privilege. But that's simply not how a Q&A site works. In fact, "your question" already betrays a misunderstanding - that's why there is content licensing. Th...
(more)
9 months ago
Edit Post #291111 Post edited:
9 months ago
Edit Post #291112 Initial revision 9 months ago