Hello!
I see lots of you are using Python. I wonder, if the infamous indentation is really so necessary? If yes, how you deal with it as a blind person?
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com
You are not logged in. Please login or register.
AudioGames.net Forum → Developers room → Is Python's indentation really necessary?
Hello!
I see lots of you are using Python. I wonder, if the infamous indentation is really so necessary? If yes, how you deal with it as a blind person?
I just count. Unless it's the absurdly inflated kind, where you're expected to press space 4 times for every level (just... why? Do most people use an editor that saves them from having to do that? What's wrong with tab?).
Notepad, at least, keeps your column position when you scroll to a line whose length is at least as great, which makes it easy to keep track of changes in level.
It also helps to double-space or comment the ends of blocks. Which, you know, is basically like braces, but for some reason people just don't like braces.
Hi,
You can set your screen reader to announce indentations. Also, using tabs instead of spaces helps. I hate the four-space rule and never use it for my own code; I always use tabs.
Don't indent python code and see what it does, it will not work, indentation takes the place of braces or start/end in other code, like if endif or in lua if end, which if in lua I always put a comment saying what the hell its ending since end is a general sort of catch all so end --if.
I don't know why its so prevalent to use spaces in python. I can see why you might do it but if you create your own standard like two spaces per indent level, for a sighted person, it means more code will show up on the screen without needing horizontal scrolling, so if you have a lot of nested blocks, but I think four spaces is the same damn thing as a tab anyway, so I don't know. Mainstream Python devs, in this case, suck it.
INdentation is used for defining python blocks.
Now you can do this with tab or space independently, and the indentation doesn't require you to press space or tab 4 times is just a convention and itt's a style written in PEP8.
You could just indent even with 1 tab per block.
yes, indentation is used for code blocks.
OK, thanks for your info. Now I know what's going on with this.
What are the differences between using tab and spaces. For example, if you need to press space four times, when using tab, do you need to press it four times, too?
you can press tab once, then if you have another if statment or a colon: then 2 tabs and so it goes on.
I hate how people complain like this about indentation this, indentation that when it comes to Python. Seriously, guys, deal with it. If you want to become a programmer in the professional workforce, you're going to be doing that a lot. And commenting your code too. So, live with it, stop complaining and wining how you don't like it. Indenting has been apart of Python's syntax since the beginning. And yes, if you're going to be programming at work, you *will* be indenting, no matter the language. You have no choice in the matter. And if you don't, your coworkers and/or boss will tell you to.
@Ethin, their question was more whether or not there's an alternative to tabbing in Python, not that indenting is bad...
You'll hate a lot of things about a lot of people the older you get.
Unrelated question, but does anyone know if it's possible to do block comments in python? It doesn't seem so based on my googling it, but maybe I missed something. It's not a huge issue, just a bit tedious to add or remove a hash in front of every line when you want to comment out a piece of code.
You can do it with something like:
"""comment text line one
line two
line three
line four
...
"""
anywhere in the code.
AudioGames.net Forum → Developers room → Is Python's indentation really necessary?
Generated in 0.154 seconds (62% PHP - 38% DB) with 12 queries