Skip to main content
19 events
when toggle format what by license comment
Jun 18, 2019 at 15:08 history edited Justin CC BY-SA 4.0
deleted 104 characters in body
Jun 17, 2019 at 14:29 comment added Justin @Toby Speight - Thanks for the edit. I might have been in a hurry.
Jun 17, 2019 at 14:28 history edited Toby Speight CC BY-SA 4.0
__name__ can be equal to '__main__', but '__name__' cannot!
Jun 17, 2019 at 13:04 comment added Konrad Rudolph @JörgWMittag Yes, it’s a POSIX rule. However, the implication isn’t that the system could legally refuse to treat it as a script (at least I’m not aware of any such rule, even implicitly). Rather, the issue is simply that some tools will not correctly handle the file; for instance, a conforming sed implementation might not handle the last line. In practice, up to date GNU sed and BSD sed both do (though slightly differently).
Jun 17, 2019 at 13:00 comment added Jörg W Mittag I believe there is some part of POSIX that specifies that text files end with a newline. So, if you don't have the newline, then your file is technically not a text file, which means that technically, the OS is not required to process it as a script, which means that if some OS vendor is an extreme stickler for the rules, then a shebang line will not work. (Although the shebang line isn't specified anywhere, so such an extreme OS will probably not implement them anyway.)
Jun 17, 2019 at 12:46 review Suggested edits
Jun 17, 2019 at 13:44
Jun 17, 2019 at 6:24 history edited Justin CC BY-SA 4.0
added 87 characters in body
Jun 17, 2019 at 4:39 history edited Justin CC BY-SA 4.0
added 417 characters in body
Jun 17, 2019 at 4:32 comment added SDG It really does help though. Exactly the kind of advice I came here looking for.
Jun 17, 2019 at 4:30 comment added Justin @SharanDuggirala - Yes, it is.
Jun 17, 2019 at 4:29 comment added SDG Thanks for the compliment on using the __name__ == '__main__'. I believe that it is essential for using the Python style unit testing?
Jun 17, 2019 at 4:27 comment added Justin @SharanDuggirala - I have removed the content. I have left anything that might help you. Hope this helps!
Jun 17, 2019 at 4:26 comment added SDG I guess it doesn't help me :( Sorry, it is my mistake for not including that crucial detail.
Jun 17, 2019 at 4:26 history edited Justin CC BY-SA 4.0
deleted 2473 characters in body
Jun 17, 2019 at 4:25 comment added SDG f-strings, on the other hand, is very legitimate advice. I read through the article and am totally convinced that this the way to go - especially with the multiline stuff.
Jun 17, 2019 at 4:22 comment added SDG I mentioned a new note on my question. The question did not necessarily require me to create a binary search tree. I did it for my convenience.
Jun 17, 2019 at 4:09 history edited Justin CC BY-SA 4.0
edited body
Jun 17, 2019 at 4:01 history edited Justin CC BY-SA 4.0
added 172 characters in body
Jun 17, 2019 at 3:55 history answered Justin CC BY-SA 4.0