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 qoheletâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: Proper location of docstring on struct with attributes Option 1. The docstring precedes the attributes by convention. Here is an example of the docstring for `std::vec::Vec`. However, if using `cargo doc` to generate documentation, it works just fine if you put it after as well. (more) |
— | 3 months ago |
Question | — |
Proper location of docstring on struct with attributes When documenting a struct with attributes, where does the docstring go? Before or after the attribute(s)? Option 1: ```rust /// Does it go here? #[derive(Deserialize, Debug)] pub struct Metadata { pub version: f32, pub contributors: Vec } ``` Option 2: ```rust #[derive(Des... (more) |
— | 3 months ago |
Question | — |
Why does this work? .collect() automatic conversion to function return type I'm completing the `rustlings` exercises as part of self-teaching Rust. While working on the third iterators exercise, I solved the exercise but don't quite understand why my solution works. Specifically, I made two functions that are identical except for their name and return type, but the functi... (more) |
— | 3 months ago |
Question | — |
Load environment variables from .env file in Python 3 In Python 2, I was able to create a file named `.env` within a project folder like so: # .env MYID=abc123 TOKEN=4567890 Then in a Python file in the same directory, I could read these variables like so: # example.py import os id = os.environ["MYID"] token =... (more) |
— | over 2 years ago |
Question | — |
Capture args from repeatable flags in Golang pflags package How do I create a flag that can be used multiple times in a command using the `pflag` package? For example, let's say I wanted to select multiple fields and did not want to have to use comma-separation with a single flag, but instead something like follows: cmd -f field1 -f field2 -f field3 ... (more) |
— | over 3 years ago |
Answer | — |
A: Are reference requests welcome here? Consider the following posts which have essentially become canonical references in their own right within their respective communities on SE: The Definitive C++ Book Guide and List (viewed 2.5 million times) The Definitive C Book Guide and List (viewed 451 thousand times) The definitive gu... (more) |
— | over 3 years ago |
Answer | — |
A: For scripting what are the pros and cons of command line arguments versus capturing input at the start? Pros of CLI arguments/flags include: Easier to leverage the tool in another script or via other automation so that user interaction is not required If certain arguments are optional and/or have default values, the user is not burdened with these choices when they are unimportant Once ... (more) |
— | over 3 years ago |
Question | — |
Are hyphens and/or underscores valid in golang package names? Can a Go package name validly contain a hyphen and/or an underscore? The godocs say that >By convention, packages are given lower case, single-word names; there should be no need for underscores or mixedCaps. However, this does not indicate if underscores are invalid/illegal vs. simply not f... (more) |
— | over 3 years ago |