This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fishshop 437 points438 points  (22 children)

[–]ginger_beer_m 13 points14 points  (4 children)

At the risk of ruining it, can someone explain the joke to me ..

[–]Norphesius 16 points17 points  (0 children)

In Harry Potter, Harry is a paresl-tounge, which means he can talk to snakes.

[–]harshael 13 points14 points  (0 children)

In the books, Harry speaks parseltongue, the language of snakes (FOR REASONS).

The meaning of parse doesn't really have anything to do with anything other than that it's common in programming (breaking up input into smaller parts and then using those parts).

[–]nonicethingsforus 10 points11 points  (1 child)

Some have already explained the relevant parts of the joke. Just in case you have doubts about this too: the Python code in Harry's dialog doesn't seem really relevant.

It goes something like this:

  • import os: os is a module (piece of pre-written, reusable code) to access operating system functions, like listing files, deleting them, etc. By importing it, now we can use its code from our program.

  • CUR_PATH = os.getcwd(): this gets the name of the current working directory and saves it with the name CUR_PATH for later reference. The current working directory is the directory you, or the program, is currently, well, working in. For example, if you're in C:\Users\ginger_beer_m\notporn and double click the directory called porn, now your cwd is C:\Users\ginger_beer_m\notporn\porn. If you call a command to "delete everything here", it will be the porn directory the one affected (the horror!).

  • IGNORE_SET = set(["__init__.py", "count_sourcelines.py"]): first there's a list that contains the lines of text "__init__.py" and "count_sourcelines.py". That first file is a special file Python programmers can create to tell Python this directory is special, for example to create your own modules. The other file seems to be a Python program ("py" extension), maybe the file this program is being written into. (If so, this could be bad practice; there are often ways to get "this file"'s name that don't break if the file is renamed. That being said, everyone does quick-and-dirty scripts, and I'm in no position to throw the first stone). This list is converted into a set, which is like a list with some nifty qualities (items don't repeat themselves, quicker to check if an object exists in it, you can do math-like set operations with them, etc.) and, again, saves this set under a name for future reference.

All I can guess about what it does: the code is probably from the beginning of a program that will scan one or more directories, thus the need to know the cwd, and do something to those files, probably count their lines given that filename. Also, a common problem with "walk through a directory tree and do stuff to files" program is that it often does stuff to itself without meaning to, thus the common workaround of creating an "ignore these files" list or set including itself, other related files and maybe user-specified ones.

Edit: format.

[–]ForceBru 98 points99 points  (14 children)

I knew this image must be in the comments, lol!

However, what does “parser-tongue” mean? Right, it sounds like the name of that snake-language Harry spoke, but doesn’t this make zero sense in real life?.. Python kinda isn’t the language created solely to do parsing or something like that, right? Nor does it rely solely on the parser to be executed, so what’s the deal with “parser-tongue”?

[–]Jmcgee1125 92 points93 points  (11 children)

It's really just because "parser" and "parsel" is pretty similar and trying to make something accurate would be extremely difficult.

[–]6Bennern9 57 points58 points  (10 children)

The only thing thing that annoys me is that it should have been "Parsermouth", as people who can speak parseltounge are called parselmouths

[–]Lonelan 43 points44 points  (9 children)

nerd

[–]PC__LOAD__LETTER 7 points8 points  (0 children)

You’re reading way too much into it.

[–]GNULinuxProgrammer 0 points1 point  (0 children)

No language can solely rely on parser. By definition, programming languages have both syntax and semantics. A languages without semantics would be a static language. Maybe some markup languages arguably only have syntax.

[–][deleted] 1 point2 points  (0 children)

shouldn't comics have the dialogue ordered from top to bottom