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 |
---|---|---|---|---|
Comment | Post #292968 |
This question is intended as a language-agnostic catch-all for a simple class of logical errors, so that beginner questions can be duplicated to it in the future. In my experience, the large majority of questions along these lines are asked by new Python programmers, but in principle the question app... (more) |
— | 22 days ago |
Edit | Post #292968 |
Post edited: move notice to comment |
— | 22 days ago |
Edit | Post #292778 |
Post edited: improve title; rm noise; copyedit for clarity and flow (put all the questions together, improve prose for layer description); formatting (list questions; fix and collapse file listing); fix tags |
— | 26 days ago |
Suggested Edit | Post #292778 |
Suggested edit: improve title; rm noise; copyedit for clarity and flow (put all the questions together, improve prose for layer description); formatting (list questions; fix and collapse file listing); fix tags (more) |
helpful | 27 days ago |
Comment | Post #292978 |
@#8046 We already have code to sort tags into a hierarchy, yes? What if we could represent the top level of that hierarchy with pseudo-tags, like "design" or "implementation", just to categorize them. Then, later, we could add pseudo-categories that filter the main Q&A to a top-level tag... ? (more) |
— | about 1 month ago |
Comment | Post #292972 |
I agree that `any` and `all` are overkill here - they're general-purpose tools, meant to illustrate that there's always that fall-back option.
The best approaches for various simple cases are... varied, because there are a lot of them. I didn't get to filling out the table because it's a daunting ... (more) |
— | about 1 month ago |
Comment | Post #292978 |
I tend to agree with these comments and I greatly appreciate the effort put into them (and the answer). I do wonder, however, if Software might be better off with separate sections for design questions vs. implementation questions. Implementations can generally be measured in terms of correctness, me... (more) |
— | about 1 month ago |
Edit | Post #292986 | Initial revision | — | about 1 month ago |
Answer | — |
A: How does the strict aliasing rule enable or prevent compiler optimizations? Aliasing is perhaps better understood as a property of assignments through pointers, not of the pointers themselves. First, let's consider the reasoning behind applying the optimization to the first example. In the first code block, the underlying storage of `b` is only assigned to via the `b` ... (more) |
— | about 1 month ago |
Edit | Post #292985 | Initial revision | — | about 1 month ago |
Question | — |
How does the strict aliasing rule enable or prevent compiler optimizations? 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 example that if we have code like: ```c int aliased(float f, int i) { f = (reinterpretcast i);... (more) |
— | about 1 month ago |
Edit | Post #292972 | Initial revision | — | about 1 month ago |
Answer | — |
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 on each side: ```python if myname in email and yourname in email: print("The email is abo... (more) |
— | about 1 month ago |
Edit | Post #292971 | Initial revision | — | about 1 month ago |
Question | — |
Simultaneous comparison in Python 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 specific variable is equal to any of some test values; etc. I discovered that these naive approaches won't... (more) |
— | about 1 month ago |
Edit | Post #292970 |
Post edited: Collapse some parts; improve some labels and such |
— | about 1 month ago |
Edit | Post #292970 |
Post edited: Show worked examples of applying the steps, and be explicit that the and/or swap is bidirectional |
— | about 1 month ago |
Comment | Post #292970 |
In addition to the arithmetic-relational operators (to compare whether values are equal and/or which is larger), Python also has an `in` relational operator - `x in y` checks whether `y` "contains" `x` in some sense (depending on the types of the values). This operation also has a negation: `not (x i... (more) |
— | about 1 month ago |
Edit | Post #292970 | Initial revision | — | about 1 month ago |
Answer | — |
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 out (i.e. `not(not x)` is equivalent to `x`), we can also infer rules for negating an expression. T... (more) |
— | about 1 month ago |
Comment | Post #292969 |
Again, I'm asking so that there's a canonical available when someone encounters the problem and the question ought to be closed as a duplicate.
Related Stack Overflow questions:
* [De Morgan's rules explained](https://stackoverflow.com/questions/2168603/de-morgans-rules-explained)
* [Why does ... (more) |
— | about 1 month ago |
Edit | Post #292969 | Initial revision | — | about 1 month ago |
Question | — |
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 some code like: if x or y: pass else: dosomething() (Of course, following ... (more) |
— | about 1 month ago |
Edit | Post #292968 | Initial revision | — | about 1 month ago |
Question | — |
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" respectively in the language documentation. However, these tools don't seem to work in a natural or expected way f... (more) |
— | about 1 month ago |
Edit | Post #292967 |
Post edited: Emphasis on the important parts, fix a bit of wording |
— | about 1 month ago |
Edit | Post #292967 |
Post edited: |
— | about 1 month ago |
Edit | Post #292967 | Initial revision | — | about 1 month ago |
Answer | — |
A: Common string handling pitfalls in C programming Understanding the representation of text in C "Text" is a high level abstraction that C doesn't properly support Fundamentally, C does not have any built-in "string" type. It arguably doesn't even have a real character type. `char` is really a numeric, integral type which has a size of one byte... (more) |
— | about 1 month ago |
Edit | Post #284850 |
Post edited: Format with details blocks for an at-a-glance view of the combined "FAQ". |
— | about 1 month ago |
Edit | Post #284849 |
Post edited: improve formatting; copyedit for clarity |
— | about 1 month ago |
Suggested Edit | Post #284850 |
Suggested edit: Format with details blocks for an at-a-glance view of the combined "FAQ". (more) |
helpful | about 1 month ago |
Suggested Edit | Post #284849 |
Suggested edit: improve formatting; copyedit for clarity (more) |
helpful | about 1 month ago |
Edit | Post #292960 | Initial revision | — | about 1 month ago |
Question | — |
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 draw an explicit comparison with Stack Overflow and related sites. The Stack Exchange network has severa... (more) |
— | about 1 month ago |
Edit | Post #292959 | Initial revision | — | about 1 month ago |
Answer | — |
A: Generating combinations of elements, which are themselves sequences of the same length, where the elements have no value in common at any position Using filtered products of candidates, over combinations of first letters Let's consider the n=2 case first. (For higher n, we can use the same sort of recursive generator approach as in my other answer, but recursing on n instead of k.) Partition the input words according to the first letter; ... (more) |
— | about 1 month ago |
Edit | Post #292958 |
Post edited: Update to match the change to the question example input |
— | about 1 month ago |
Edit | Post #292957 |
Post edited: Reduce the input set to a more tractable size to facilitate comparisons and discussion |
— | about 1 month ago |
Edit | Post #292958 | Initial revision | — | about 1 month ago |
Answer | — |
A: Generating combinations of elements, which are themselves sequences of the same length, where the elements have no value in common at any position Using a recursive generator There isn't anything like a built-in solution for this algorithm, but it's easy to express the desired output recursively. A valid output combination of k-many inputs looks like an arbitrarily selected first element, followed by a combination of k-1-many elements that: ... (more) |
— | about 1 month ago |
Edit | Post #292957 |
Post edited: |
— | about 1 month ago |
Edit | Post #292957 |
Post edited: More clarification and mathematical rigor. |
— | about 1 month ago |
Edit | Post #292957 |
Post edited: |
— | about 1 month ago |
Edit | Post #292957 | Initial revision | — | about 1 month ago |
Question | — |
Generating combinations of elements, which are themselves sequences of the same length, where the elements have no value in common at any position This question is adapted from a question I just helped fix up on Stack Overflow. I'm giving a different motivating example which I think will make it clearer what the requirements are and why a naive approach would take prohibitively long. (Also, I want to attempt an answer, but by personal polic... (more) |
— | about 1 month ago |
Comment | Post #292774 |
I think this is simply a "mental typo" or failure to think it through properly. As a hint: you say that your "goal is to compile all `*.c` files" - notice that you *didn't* say "all `%.c` files"? Also, if you're using existing Stack Overflow Q&A to try to solve something, obviously you shouldn't coun... (more) |
— | 2 months ago |
Edit | Post #292334 | Initial revision | — | 4 months ago |
Answer | — |
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 system state and input data needed for test execution.2 For example, the Ruby on Rails web framework us... (more) |
— | 4 months ago |
Comment | Post #292286 |
What kind of danger specifically do you have in mind? This is a very different question if it's about supposed security exploits vs. losing work by overwriting your working copy. (more) |
— | 4 months ago |