Timeline for Should code be edited so that it is visible rather than being in one long line?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 12, 2022 at 17:44 | comment | added | PM 2Ring |
Of course, I'm only talking about data that's intended to be human-readable, not stuff like the dput data that camille focuses on in this answer.
|
|
Jan 12, 2022 at 17:32 | comment | added | PM 2Ring | @code11 I think it is often a good idea to make data more readable, so that readers can quickly verify that the code matches up with the data without having to load it onto their own machine. With JSON, it's easy enough to load the badly-formatted data & dump it back out with decent formatting. Of course, if you discover a bug in the JSON, then you abandon the edit & post a comment telling the OP to fix it. If the data is so huge that reformatting it crowds out the actual code, tell the OP to trim it down to a more manageable size to make a proper MCVE. | |
Jan 12, 2022 at 17:17 | comment | added | code11 | Hmm. Maybe. If there's a huge chunk of json, lets say, squashed at the top which initializes the code below, and expanding it would crowd out the actual code, I can see an argument for keeping it condensed. | |
Jan 11, 2022 at 21:57 | comment | added | camille | @code11 I think if it is in a form that can easily be read by a human and can be formatted to be read on the screen, you often might as well. In fact, just a minute ago I edited a post to, among other things, split the creation of a data frame across 2 lines instead of 1, but I could do that because it just came from 2 lists of 10 or so numbers. But yeah, a lot of the time it's a bonus but not strictly necessary | |
Jan 11, 2022 at 21:51 | comment | added | code11 | Agreed. This almost deserves its own question: Should Data be edited so that it is visible... And I'd respond that it probably shouldn't. | |
Jan 11, 2022 at 21:14 | comment | added | Jeremy Caney |
Thank you to both @user438383 (in the comments) and camille for clarifying that bit about dput() . That makes good sense—and is certainly a consideration I was ignorant of.
|
|
Jan 11, 2022 at 19:26 | comment | added | user438383 |
Agreed, it is a peculiar example to give, as dput() output is probably the single piece of code where having it all on a single line makes it easier for the answerer.
|
|
Jan 11, 2022 at 18:10 | history | answered | camille | CC BY-SA 4.0 |