![]() If you are a beginner to Python programming or new to programming, IDLE is the best place to start with. Stepping and Viewing of local and global Namespace.Now as for having that interactive mode in IDLE, I have yet to understand what the advantages of that are exactly but I’m sure that will become apparent once I get deeper into Python.Related Article: 10 Best Python IDEs for Linux Programmers IDLE Features But apparently that’s not the case and it’s in fact similar to the Autohotkey stuff. But when I started the Pythin tutorial mentioned in my first post I was referred to downloading the Python software so I assumed I needed that specific software to be able to write and execute Python scripts. The Autohotkey stuff I ‘wrote’ was written in notepad and then saved as. I want to be able to come up with my own solutions, so to say. ![]() So I understand the concept of how programming languages are structured but I’ve never bothered to look beyond that, which I am trying to now by learning Python form scratch. To put it in context: I am not a coder, yet, but I have ‘written’ code and when I say that I mean that I’ve written stuff in, for instance, VBA in Excel and in Autohotkey using parts of already written code and editing that with the help of Google searches to make it fit my various needs. This might be where I started to misunderstand stuff. A standard terminal, is that more or less equivalent to writing code in notepad or a similar text editor? While IDLE is interactive because it executes lines of code as you put them in not after executing your entire script? I’m slowly starting to understand things. I added a draft issue to the IDLE Issues project. IDLE could then fix the code as requested. This would allow augmenting the message with more explanation and in this case, ask whether the unindented line is missing an indent or whether the user forget the blank line and wants the line to begin a new statement. I am thinking about changing IDLE’s Shell to put syntax error messages in a popup box, like it does in editors. But then users would not learn to enter blanks and would have trouble when using a standard terminal. Given some other changes, IDLE might guess to interpret a no-indent line like “greetings()” the same as a blank line, and execute the previous code. However, It adds indents for the user, so a user is less likely to accidentally enter a line with no indents. IDLE uses the standard library code.InteractiveInterpreter class, which intentionally imitates Python’s interactive mode. Note that in a command-line terminal, users must explicitly enter all indents, and it is easy to accidentally hit too early. It refuses to guess and raises the error. (For consistency and simplicity, this includes single-line compound statements like if 1: pass.) Otherwise, the interpreter does not know whether an un-indented line is missing 1 or possibly more indents or is the beginning of the another statement. In interactive mode, it requires a blank line to mark the end of compound statements. Python is a statement-oriented language, not a command-line language. Maybe the author was working that way.īesides, with the code in a file you can go back and make changes easily There are no blank lines in the foo.py file because it is not being In some file “foo.py”, and another window where I run it like this: python3 foo.py ![]() Usually instead I have my programme inĪ text file, and a separate window where I run it. Personally, I usually use interactive Python (IDLE or things like it)įor very simple tests of things. There’s no need to include gratuitious blank I haven’t checked out what you were watching, but likely he just hadĬcode in a file somewhere. I just don’t quite understand why the author didn’t add that line to begin with and then it was pointed out that he didn’t use IDLE but not what he used instead of IDLE. Indicate, “no, I’m not adding more lines, pleae run things now”. When that code is an indented chunk of lines thenĪnother code line is always acceptable, so you need a blank line to ![]() It is entirely a thing for IDLE’s interaction, where the user is typingĬode line by line. In that it means: “ok, I’m done supplying this chunk of code”?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |