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
Suggested Edit Post #284910 Suggested edit:
Explicitly indicate the error; rephrase slightly for clarity
(more)
helpful about 1 year ago
Comment Post #290057 I decided to add an answer to this old question in order to try to expand some detail and give more clarity, taking into account the comment feedback on the original answer. That answer is high-quality and very much to the point; but some readers might want a more in-depth treatment. At some futur...
(more)
about 1 year ago
Edit Post #290057 Initial revision about 1 year ago
Answer A: Why are list comprehensions written differently if you use `else`?
These two uses of `if` are different The `if` at the end of a list comprehension syntax: ```python [num for num in hand if num != 11] ``` is a filter; its purpose is to decide whether or not the resulting list should contain a value that corresponds to any given `num` (`for` each one found `in...
(more)
about 1 year ago
Edit Post #290050 Post edited:
disable inappropriate auto-detected formatting for template
about 1 year ago
Suggested Edit Post #290050 Suggested edit:
disable inappropriate auto-detected formatting for template
(more)
helpful about 1 year ago
Comment Post #290032 I always use `git add -p` for this, and had assumed that the `p` stood for "partial". I checked the documentation and indeed the long version of the flag is "patch". Interesting.
(more)
about 1 year ago
Comment Post #289985 I already touched on this idea [here](https://software.codidact.com/posts/289599). I do like the idea that such questions go in a separate category. In the long run it will make curation easier, since all the viable duplicate targets will be in the Q&A category, which can then be used as a powerful s...
(more)
about 1 year ago
Comment Post #289907 I started writing an answer to this question despite my misgivings, but I think they're too serious to ignore. While the general idea is excellent, there are two serious problems here: 1. Most of the question is language-agnostic (i.e. figuring out what needs to be sent to stdout); the only Python...
(more)
about 1 year ago
Comment Post #289829 Perhaps "local" was meant to mean "only exists locally"?
(more)
about 1 year ago
Comment Post #289780 It's probably worth pointing out that such shifting-and-book-keeping is O(N); that if order doesn't need to be preserved then the last element can simply be moved directly into the vacated space; and that removing multiple elements at once (whether identified by a separate collection of indices, by a...
(more)
about 1 year ago
Edit Post #289754 Post edited:
about 1 year ago
Comment Post #289753 I want to split this up so that there is a separate question for the workarounds. It feels a bit shoehorned in here, especially since the *underlying* problem (early binding of defaults) has *other effects* (e.g. not supporting a default parameter "based on" another parameter). Also, I plan to hav...
(more)
about 1 year ago
Edit Post #289759 Initial revision about 1 year ago
Answer A: Understanding mutable default arguments in Python
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, where the function will only use it for lookup without actually mutating the provided object: ``` ...
(more)
about 1 year ago
Edit Post #289756 Initial revision about 1 year ago
Answer 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-query separation; a function should take its effect either by mutating one or more parameters (a "comman...
(more)
about 1 year ago
Edit Post #289754 Initial revision about 1 year ago
Answer A: Understanding mutable default arguments in Python
Terminology "Mutable default argument" means exactly what the individual words would suggest: it's an argument which is supplied as the default value for that parameter, which also is mutable. To mutate an object means to change its state - for a list, that includes adding, removing, replacing or ...
(more)
about 1 year ago
Edit Post #289753 Initial revision about 1 year ago
Question Understanding mutable default arguments in Python
Consider this code example: ``` def example(param=[]): param.append('value') print(param) ``` When `example` is repeatedly called with an existing list, it repeatedly appends to the list, as one might expect: ``` >>> mylist = [] >>> example(mylist) ['value'] >>> example(mylis...
(more)
about 1 year ago
Comment Post #285818 Stack Exchange is dominated by Stack Overflow because it was originally an idea by and for programmers, who later realized almost as an afterthought that the same software and format could be used to build Q&A about other topics. Codidact comes years later, after seeing how the Stack Exchange model h...
(more)
about 1 year ago
Comment Post #289725 Proper answers to this will depend *strongly* on your exact needs. The Pickle format is about as general as is ever feasible, and is way overkill for most serialization.
(more)
about 1 year ago
Edit Post #289714 Post edited:
fix formatting and grammar
about 1 year ago
Comment Post #289714 This site is for concrete questions and answers. It isn't reasonable to expect "help" with figuring out a possible problem buried within dozens of lines of "code" (which seems to be a mixture of things that you wrote and messages that you got when you tried to do something). It's also impossible to u...
(more)
about 1 year ago
Suggested Edit Post #289714 Suggested edit:
fix formatting and grammar
(more)
helpful about 1 year ago
Comment Post #289251 "I just can't imagine that someone would think about tuples in this kind of scenario." I think you've misunderstood. The word "tuple" here is **only** used to describe the **result of** the non-working attempt.
(more)
about 1 year ago
Comment Post #289700 I hadn't actually thought about using a helper class for interpreting the bits of the integer used to represent universe subsets - you might consider adding an answer to refine this idea, or proposing an edit :) (Although it's not exactly clear to me that this makes things any easier than just using ...
(more)
about 1 year ago
Comment Post #289707 Sorry, I don't understand how "code obfuscation" relates to the other concepts here. Aside from that, this is a good start to the discussion, but I don't feel like I've moved significantly closer towards choosing from the options I presented....
(more)
about 1 year ago
Edit Post #289701 Initial revision about 1 year ago
Question 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 useful. The goal of the actual content is to demonstrate standard techniques and clear up common misc...
(more)
about 1 year ago
Edit Post #289700 Initial revision about 1 year ago
Answer A: Are questions about (abstract) algorithms and datastructures considered on-topic?
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 seem to have been any objection in the original feedback process. I formulated the question with t...
(more)
about 1 year ago
Comment Post #289251 It seems appropriate to show common non-working attempts, because that will help someone who is redirected here after trying one of them. I'll try to simplify the wording, and move the point about versions to a footnote.
(more)
about 1 year ago
Comment Post #289691 The [site topicality guidelines](https://software.codidact.com/help/on-topic) explicitly permit Q&A about "Software design, architecture, or modeling", which I think this is.
(more)
about 1 year ago
Comment Post #289692 Of course, that will get into language-dependent details. The languages that *do* support large integers tend to represent booleans as separate objects and not necessarily have a bit-vector abstraction, so that can incur a lot of overhead again. But the main idea here is the representation of "subset...
(more)
about 1 year ago
Edit Post #289692 Initial revision about 1 year ago
Answer 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 element in the universe sequence; if the 2s bit is set, the set contains the 1st element; if the 4s bit, the 2...
(more)
about 1 year ago
Edit Post #289691 Initial revision about 1 year ago
Question 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 might not initially be distinct, either). My language has a built-in (or standard library) representati...
(more)
about 1 year ago
Comment Post #289605 Do you need to be able to interrupt individual calls to `do_big_task`? Or only check in between each call, whether there has been a keypress since the previous call?
(more)
about 1 year ago
Edit Post #289599 Post edited:
about 1 year ago
Edit Post #289599 Initial revision about 1 year ago
Question What categories could we benefit from having?
So far, existing Meta discussion seems to have at least hinted at the possibility of using separate categories here: To shuffle closed questions out of the way (globally for Codidact) (also) For debugging help requests (discussed in passing) (also) To recommend books or other resources To p...
(more)
about 1 year ago
Edit Post #289598 Post edited:
HTML hack to avoid bogus links
about 1 year ago
Edit Post #289598 Initial revision about 1 year ago
Answer A: 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 concepts; web pages may work much better. Some people like video tutorials; I personally have found th...
(more)
about 1 year ago
Edit Post #289597 Post edited:
about 1 year ago
Edit Post #289597 Initial revision about 1 year ago
Question 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 exist, and well-informed developers should know about all of them. Would it make more sense to split the cont...
(more)
about 1 year ago