2018-06-24 12:16:59

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?

Raduvay se, raduvay
Raduvay se domaki ne
Kolko liste po gorach
Tolko zdrave na taz kyshcha

2018-06-24 13:14:16

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.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

2018-06-24 14:13:28

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.

Thumbs up

2018-06-24 14:36:13

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.

The bipeds think this place belongs to them, how cute.

Thumbs up

2018-06-24 15:41:43

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.

If you want to get in touch with me you can follow me on Twitter
have a nice day.
Paul

2018-06-24 16:29:26

yes, indentation is used for code blocks.

best regards
never give up on what ever you are doing.

2018-06-25 12:36:11

OK, thanks for your info. Now I know what's going on with this.

Raduvay se, raduvay
Raduvay se domaki ne
Kolko liste po gorach
Tolko zdrave na taz kyshcha

2018-06-27 14:44:07

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?

Thumbs up

2018-06-27 15:18:18

you can press tab once, then if you have another if statment or a colon: then 2 tabs and so it goes on.

best regards
never give up on what ever you are doing.

2018-06-27 17:05:45

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.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.

Thumbs up

2018-06-28 02:23:46

@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. big_smile

Thumbs up

2018-06-28 05:04:25

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.

Thumbs up

2018-06-28 06:17:05

You can do it with something like:
"""comment text line one
line two
line three
line four
...
"""
anywhere in the code.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.

Thumbs up

2018-06-28 10:13:23

I never get bored of indentations, just asking. smile

Thumbs up