Advertisement

Need help with Python (blocks)

Started by August 22, 2015 03:18 PM
2 comments, last by Aledrinker 9 years, 4 months ago

Hey guys

Im using Python 3 and im struggling with blocks, i know it may sound a bit weird but is there a way to make Python

mark blocks with colored squares? Its just that sometimes with many different blocks and with all the lines of code i just loose myself.

Like when i start a block, it will appear under the line of code such a "while" and in a colored square

image002.jpg

Do you use an editor to enter Python code?
If not, by all means do that, the interactive mode isn't intended to write more than 4 lines of code, for testing!

If you do use an editor, the editor would do such functionality, Python itself can only 'run' code, the Python-editor (which is a separate program) shows the code, and let's you edit save and load it.
Unfortunately, I have never seen any editor that does what you want.

In what way do you get lost? Maybe you can figure out a way to setup your code in a less confusing way?

One option that should work is to add "# end if" lines or "#end while" lines with the correct indentation.
The disadvantage of that solution is that nobody else does that afaik, so you'd still get lost with code by others.
Advertisement

If you don't like how Python is dependant on whitespace and find it unreadable, why have you choosen this language?

There are many editors, which might help you with this, but maybe you'd be better off learning a comparable language with sane syntax, like Ruby?


If you do use an editor, the editor would do such functionality, Python itself can only 'run' code, the Python-editor (which is a separate program) shows the code, and let's you edit save and load it.
Unfortunately, I have never seen any editor that does what you want.

Building on this response, I've also not seen an editor that highlights blocks quite like this. The most similar thing I have seen are "indentation guides" -- lines or colored columns placed at each level of indentation. You can see if there are settings or plugins that enable indentation guides in the editor of your choice.

This topic is closed to new replies.

Advertisement