Pasting code into the cmdline interpreter
Ben Finney
ben+python at benfinney.id.au
Thu Sep 22 01:24:36 EDT 2016
Veek M <vek.m1234 at gmail.com> writes:
> 1. I had to turn on <TAB> highlighting to catch mixed indent (which is a
> good thing anyways so this was resolved - not sure how tabs got in
> anyhow)
The EditorConfig system is a growing consensus for configuring a code
base to instruct text editors not to mangle it. See the EditorConfig
site <URL:http://editorconfig.org/> for more information.
Sadly, it seems Kate does not yet recognise EditorConfig instructions
<URL:https://bugs.kde.org/show_bug.cgi?id=330843>. In the meantime,
manually configure Kate to only ever insert spaces to indent lines.
> 2. Blank lines in my code within the editor are perfectly acceptable
> for readability but they act as a block termination on cmd line.
Yes. That is a deliberate compromise to make it easy to write code
interactively at the interactive prompt.
> I get:
> IndentationError: unexpected indent
>
> How do i deal with this - what's the best way to achieve what I'm
> trying to do.
Since you are writing code into a module file, why not just run the
module from that file with the non-interactive Python interpreter?
--
\ “The restriction of knowledge to an elite group destroys the |
`\ spirit of society and leads to its intellectual |
_o__) impoverishment.” —Albert Einstein |
Ben Finney
More information about the Python-list
mailing list