![]() Ask Question Asked 7 years, 11 months ago. For example: for i in range(10): print(i) for i in range(10) When I input :, Emacs adds a. I like CodeAcademy this is hardly a deal-breaker, but I fail to see why I need to be the one to reset the defaults in my own coding environment. When writing Python code, Emacs behaves strangely with respect to indentation. In fact (although my search has admittedly been pretty limited), I have thus far been unable to find any Python editor that defaults to two spaces. Make sure the code's indented into a valid code block. Of course I can reset my defaults, but why should I have to? Out of the box, IDLE, P圜harm, SublimeText, Atom and Thonny all default to four spaces. Click and drag with your mouse to select the code (the last print statement), or press Shift while using your arrow keys. No, the IDE’s don’t complain about any particular number of tabs or spaces as long as it is consistent, but if I cross over back and forth between P圜harm and CodeAcademy I get into trouble pretty quickly. You may have code such as: or you may have something like: Where one line has a single tab (so an indent level of 1) and the other has spaces. You indent your code anyway, right Python doesnt enforce a specific standard, you can indent however you want, just. I agree, if you stay strictly within the CodeAcademy editor, the main problem is mixing tabs & spaces, but I still maintain that the default choice for the editor is an inconvenient one for those of us who sometimes use a different IDE or editor (at least, those of us who who are not Google engineers.) The indentation is not a big deal at all. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |