4 ms·
One thing i miss in languages like python that don't enclose blocks in {} is the convenience of using % to find the matching beginning/end of the block.
by ristretto 15y ago
One thing i miss in languages like python that don't enclose blocks in {} is the convenience of using % to find the matching beginning/end of the block.
- sixtofour 15y agoThat, and the lack of constant constants (class workarounds don't do it for me) are the only two "complaints" for me. On the whole I really like significant white space (despite my suspicions before taking up the language). With a brace-blocked language like C, indentation can fool you into thinking there's a block when there really isn't. This is very unlikely to happen in Python. A section of code that looks like a block due to indentation is virtually certain to be a single coherent block. I love that.
- igorgue 15y agoI use "vii" in normal mode to do that. It basically selects the block. http://vim.wikia.com/wiki/Indent_text_object http://vim.wikia.com/wiki/Indent_text_object
- iloveyouocean 15y agoI haven't tried it in Python, but it's worth checking out matchit. http://www.vim.org/scripts/script.php?script_id=39 http://www.vim.org/scripts/script.php?script_id=39 matchit generally seems to do a good job at identifying beginning/end pairs in a variety of languages.
- razzmataz 15y agoIn my years of experience, I've found that huge ass blocks of code where % is useful in finding the beginning/end of a block are usually in need of massive amounts of refactoring.