-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Style all code samples #125
base: source
Are you sure you want to change the base?
Conversation
I try not to be too dogmatic about it, but I'm squarely in camp Given LOST's primary goal is to encourage said language switching and multilingualism, I'm prepared to advocate for Rest looks good... maybe with the exception of the blockquotes styling. I like to group like with like and so the second option seems far more natural to me. |
Heh, I'm squarely in |
Hah! I figured this PR might be slightly more controversial than the tests ;-) |
@NickCH-K Calling in some R heavy hitters to back me up here, here, and here ;-) (K, easy to find countervailing views but I personally find these arguments compelling alongside my own teaching experiences. Most annoyingly, I recall someone linking to Ross Ihaka himself expressing regret about the arrow assignment — other languages seem to be doing fine and he apparently prefers UPDATE: Found it! https://youtu.be/88TftllIjaY?t=2100 (the whole talk is great btw; I think you two will both enjoy it.) |
I'm not an R expert (by any means!), but my understanding was that both the Google and tidyverse R styles prefer arrows. Is there an argument for following these styles, especially when most people coming to LOST are likely to have come via the tidyverse suite of packages? (Anecdotally, tidyverse seems by far the most popular route into the R ecosystem.) |
fwiw, @aeturrell I assume as the other Pythonista here you have no objections to |
@khwilson: |
<- is preferred over = in R for at least two reasons. First it is consistent with <<- the assignment operator to assign an object to the parent environment. Second, = has restrictions on its use, such as being leftward only (in contrast, -> works just like <- as in 15 -> x). See also Forms of the Assignment Operator in R. |
In the spirit of #123, I think we should also encourage code to be styled similarly (so it's easier to compare examples across all of LOST).
This PR adds a styler for R and Python code. It uses
black
for Python andstyler
for R. It also proceeds to style all the code.Notably, these stylers are pretty opinionated, so before committing, it would be good to make sure that this is the set of rules that people are comfortable with. In particular, in R, some controversial rules are:
<-
instead of=
"thing"
not'thing'
)=
not