Skip to content
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

'Tabs and Spaces' example does not actually include tabs #221

Closed
adamobeng opened this issue Jan 27, 2016 · 6 comments
Closed

'Tabs and Spaces' example does not actually include tabs #221

adamobeng opened this issue Jan 27, 2016 · 6 comments

Comments

@adamobeng
Copy link
Contributor

The "Tabs and Spaces" callout in lesson 7 includes a code example where supposedly "the first two lines are using a tab for indentation, while the third line uses four spaces". In fact, all three lines use spaces for indentation.

Someone copying this example would not be able to reproduce the error.

I'm opening an issue rather than just fixing it, because:

  1. this might be a deliberate decision (the markdown file also has spaces, so this is not just a conversion problem)?
  2. fixing it is non-trivial, given that pandoc converts tabs to spaces by default (the '--preserve-tabs' option would have to be added to the pandoc call in the Makefile).
wking pushed a commit to wking/swc-python-novice-inflammation that referenced this issue Jan 30, 2016
Ignore conduct.md and contributing.md. No, really.
@gvwilson
Copy link
Contributor

Yeah, this is hard to fix given that we're using Markdown...

@gvwilson gvwilson self-assigned this Jul 31, 2016
@gvwilson gvwilson removed their assignment Sep 10, 2016
tbekolay added a commit that referenced this issue Nov 2, 2017
@yeemey
Copy link
Contributor

yeemey commented Apr 20, 2018

I typed out the code example as described in Jupyter, and cannot reproduce the TabError. Trying this out in the command line gives me an IndentationError instead.

Either we revise the example to reproduce the error (I tried some random combinations of tabs/spaces, and couldn't get it), or remove it and just note that it's not good practice to mix tabs and spaces?

From the Python 3 docs:

Tabs are replaced (from left to right) by one to eight spaces such that the total number of characters up to and including the replacement is a multiple of eight (this is intended to be the same rule as used by Unix).
...
Indentation is rejected as inconsistent if a source file mixes tabs and spaces in a way that makes the meaning dependent on the worth of a tab in spaces; a TabError is raised in that case.

@maxim-belkin
Copy link
Contributor

Hey @yeemey!
Could you please be more specific as to which line in which file you're talking about. Thank you!

@yeemey
Copy link
Contributor

yeemey commented Apr 20, 2018

Hi @maxim-belkin,
It's the episode 7 lesson on errors and exceptions.

It's ~line 182 in my forked repo with 07-errors.md.

@tbekolay
Copy link
Contributor

I typed out the code example as described in Jupyter, and cannot reproduce the TabError

You have to copy/paste the example, not type it out manually.

@tbekolay
Copy link
Contributor

And actually this issue should be fixed now as I did change the HTML to have explicit tabs in there; I just copy/pasted and it worked for me.

zkamvar pushed a commit that referenced this issue Apr 21, 2023
Based on info from this site: https://daringfireball.net/projects/markdown/syntax#html
I have replaced the markdown code block with html code (copied the html source from http://swcarpentry.github.io/python-novice-inflammation/07-errors/ and added a tab). The indentation has been increased on all lines as html tabs are 8 characters wide, not 4 and it is hard to change the html tabs to 4 characters.
zkamvar pushed a commit that referenced this issue Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants