4 ms·
I found the whitespace rules on Python frustrating when first beginning. I'd be inclined to do Javascript/HTML first. It's fun, easy, and very visual.
by kenjackson 16y ago
I found the whitespace rules on Python frustrating when first beginning. I'd be inclined to do Javascript/HTML first. It's fun, easy, and very visual.
- tjr 16y agoWas Python your first language? After using other languages, I too found the significant whitespace to be frustrating at first, but I wonder if someone for whom Python was their first programming language would be similarly frustrated or not?
- kenjackson 16y agoIt wasn't my first language. And I should note that I wrote my last real Python program before most here probably started (1998) -- so things may be sufficiently different now so its less of an issue. But I do find Javascript/HTML to be so pleasant and easy for beginners that I find it hard to suggest anything else. Your "hello world" program is just: "Hello world" In an html file. ;-)
- baddox 16y agoPython was my second language, after Java. I found the whitespace "rules" (I can only think of one) a non-issue, since I always properly indented by Java code anyway. Python just took the indentation that was already there and used it as information. I'm always surprised to see even seasoned programmers attack Python for its whitespace being confusing. The only confusion or problem I can imagine encountering with Python is the spaces vs. tabs debate, and even that is only an issue if you're working with developers who disagree with you on the debate. In a job environment, hopefully there will be a style guide that's accepted and enforced by the developers. Of course, PEP 8 technically settles it for the Python community.
- kenjackson 16y agoAs someone who was experienced I did find it frustrating -- I can recall almost wanting to write a new editor because doing things like I used to (cutting and pasting loads of buffers and refactoring code) just didn't work very well. Again this is pre-1998, so I'm sure now this works just fine, but then it was just frustration. Or at least that's how I recall it.
- joshes 16y agoPython was my first language and the white space rules simply "made sense" for me at the time. In fact, using Python for a while at such an early stage started to ingrain a oneness with Python's unique syntactic idiosyncrasies. It seems somewhat second nature at this point.
- tjr 16y agoThanks for sharing! It makes sense that significant white space would only seem odd if the habit of insignificant white space had already been acquired.
- hsmyers 16y agoHaving in the long ago gotten used to Fortran on punch cards, Python wasn't that much of a reach and as it solves a particularly annoying problem (code formatting) I didn't have that much of a problem of getting on board with it. On other projects in other environments I typically run all code through a formatter and accomplish a similar goal. Regards first language? I really don't think it matters just so long as there is a second language to come...
- sixtofour 16y agoC/C++ background. Python whitespace concerned me at first. Now I think it's the greatest thing since sliced white bread. It's liberating. You don't have to think about it. You don't have to care. About the only thing left to argue about is how many spaces per indent, but that's solvable by agreeable people and whatever PEP (I forget) says how many spaces.
- blacksmythe 16y ago>> left to argue about is how many spaces per indent ... Zed has recommendations for setting up an editor (gedit) and configuring tabs and other settings for Python: http://learnpythonthehardway.org/index http://learnpythonthehardway.org/index
- baddox 16y agoFYI, it's PEP 8. It admonished 4 space characters for an indentation (and most IDEs or text editors will handle that intelligently i.e. with the Tab key on the keyboard). Technically, it allows for 8-space tab characters for "really old code." http://www.python.org/dev/peps/pep-0008/ http://www.python.org/dev/peps/pep-0008/
- haploid 16y agoI wouldn't categorize whitespace-as-syntax to be merely "frustrating". I'd categorize it to be "wrong".
- olegp 16y agoAnd if you do decide to go with JavaScript, may I suggest you try it in Akshell http://www.akshell.com http://www.akshell.com
- d0mine 16y agoIn general whitespace is not significant in Python source code http://www.secnetix.de/olli/Python/block_indentation.hawk http://www.secnetix.de/olli/Python/block_indentation.hawk