If I understand the situation well, what you’re stumbling over here is a Python Syntax problem. For Python, indentation matters as you know, but it also matters how you define the indentations. It can bei EITHER all tabs OR all spaces. Mixing them is not allowed.
What happens then is that Dynamo executes your script up to the point where you try to append the list you created to another list in line 26. At that line, Python throws an error, and script execution stops. But before that, you have already filled in some data in the loop, and that’s what you see in the output.
I like using the “show white space in python editor” feature to quickly identify these issues, as the CPython 3 and IronPython 2.7 engines have different settings.
It’s a debate that has existed for a long time. One of the reasons to be “pro” spaces is that it is consistent on every machine and every reader. IDEs can have different settings for what a “tab” press does, like in Visual Studios, you can set a tab to be either a tab or a set amount of spaces. These are settings per user.
If one person has tab to be 4 spaces, one has it to be a tab, and another has it to be 2 spaces, when they collaborate everything breaks.
Along with that, some readers (like IDE vs notepad, etc.) might display tabs differently. If it is commented a certain way but the tabs don’t line up when the next person opens it, it just gets hard to read and confusing. Spaces are uniform (outside of like MS Word if for some reason you are using that).
I’ve worked with a few people who are visually impaired, and their braille screen reader gave 40 characters at a time. Four spaces eats up 1/10 of the readable real estate. That’s one offset, but I am guessing you often have two levels in quite a few sets of code. Well that’s 1/5 of what an impaired user can see at a time.
If you used tabs it would be 1/20th.
Now that is a very unique situation, but I want what I do with Dynamo to be as accessible and inclusive as possible; if using tabs makes some PEP advocates angry but allows one hypothetical user to utilize the tool more readily… well in that case PEP is going out the window.
The disadvantaged user gets priority. Every. Single. Time.
By consistent I mean that every program has spaces be exactly 1 character, so 4 spaces is 4 characters. Doesn’t matter what program you use to read, spaces are treated consistently. Tabs can mean different things in different programs, most are 4 characters, but notepad (bad example but still counts) have tabs as 8 characters.
What you wrote out to look a certain way in your IDE isn’t the same for everyone who has to use it.
But I am in the “tab set to 4 spaces” category, so I can press tab but get the consistency of spaces.
Edit: Also an option for screen readers, Google’s style guide has their indents set to only 2 spaces, so its not as much real estate but still has the consistency of spaces.
It’s one character which is 8 units long. Turning on the ‘display white space’ in the editor being used will help clear that up. In either case, the Python interpreter won’t care how anything is displayed as long as the number of tabs (or spaces) is consistent. If it shows as 8 characters, 3 characters, or 200 characters wide is irrelevant. Similarly I could change the display thickness between new line characters in a given IDE, but it’s a moot point as far as the interpreter is concerned - each line terminates with \n under the hood.
Either way I am in team tabs for Python work; I think everyone can agree that allowing both is good, bir this is not possible in the current CPython implementation as everything is four spaces, which is a known bug that goes back as far as the CPython engine’s history.
Dynamo has had Show Whitespace Characters for a long time now In later versions it’s under the Preferences Panel, in earlier versions under the Settings menu.