On 24/07/2016 15:51, Chris Angelico wrote:
On Mon, Jul 25, 2016 at 12:44 AM, BartC <b...@freeuk.com> wrote:
Your attention is diverted, you're doing something on your desk, but you hit
one of the keys by mistake. You might have pressed Delete or you might not.
You look at the screen which has a 5000-line program open, and you see this
(borrowing your example and with the cursor at "_"):
def f():
for x in seq:
do_this()
do_that()
_ do_more()
Did you just unindent do_more(), or is that where it's meant to be? Undo may
or may not help (or it may undo something is needed).
Undo, redo. See what happened. Easy.
Also, if you're regularly committing to source control, you can always
check the diff. Before you 'git commit', check what 'gitk' shows, or
before 'hg commit', have a glance at 'hg diff'. Make sure what you're
seeing is what you intend to change. Remember, code doesn't just
accidentally change; everything should have purpose, including
(especially) any indent/unindent.
Source control protects you from everything other than multiple
changes since the last commit. So commit often. It'll save you a lot
of time - if not coding time, then debating-on-python-list time. :)
OK. I understand that it is not possible to point out any kind of
weakness of a language (any language not just Python!) because the
counter-argument is always going to be about:
Use syntax highlighting, use a smart editor, use a version control
system, use a linter, use 'tabnanny', use tool X, Y or Z to get around
the problems, use obscure language options..
The thing is, if everyone does depend more on such tools, then it really
doesn't matter exactly what the language does - the tools will take care
of such details. So the language could delimit blocks using any scheme
it likes, including use 'end', 'else' and so on.
It only becomes important to people like me who use plain editors.
--
Bartc
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list