On disemvowelling and creationism

As some of you have no doubt noticed, I’ve disemvowelled a fair number of comments in the past week. This is partly because while I like the degree of transparency disemvowelling allows for in principle, disemvowelling rather than simply deleting comments that violate my comment policy was too much work… until now.

You see, I’ve been learning to program in Python, and midway through an “online intro to Python” thing I’ve been doing, I realized it had given me everything I’d need to write a Python script for disemvowelling text. The script is here, if anyone else wants to use it. It’s set to loop until you hit “enter” without entering any text; the “special commands” are just hitting “1″ or “2″ to generate a couple stock-warnings specific to this blog, but which can be easily replaced with something else if you want to use that feature for yourself.

While I’m on the topic of comment moderation, I should mention that I will be very unsympathetic, comment-moderation wise, to comments espousing creationism or attacking evolution. This is because, while I’m happy to let people debate the moral acceptability of genocide or whatever, the evolution-creationism debate has been done to death, even more so that some of the other issues discussed on this blog. The scientific consensus is absolutely overwhelming, and there is a website anyone can access that has refutations of damn near every creationist argument ever made.

This does not mean I am banning creationism entirely from the comments here. It does mean that if you come here saying atheists are stupid because they think everything happened by chance, other people will be free to point out without further elaboration that you are obviously either stupid, ignorant, or dishonest, and I will do nothing about it. That’s because they’ll be right, and the reasons they will be right have been explained so many times that they shouldn’t have to re-explain it.

(It occurs to me that this thread will be much more entertaining if one or more creationists start commenting on it. One reason for not banning creationism entirely.)

  • JohnH2

    ” happened by chance”

    The appearance of chance does not rule out mindfulness of the process.

    • Rain

      It doesn’t rule out “chance” either. It doesn’t rule out a lot of things. Yay!

    • Dorfl

      The point is that evolution works through chance mutation and non-random natural selection. So anyone who says “Evolutionists think life just happened by chance!” has made no honest effort to understand the subject.

    • Reginald Selkirk

      The appearance of chance does not rule out mindfulness of the process.

      Stand back! I am armed with Occam’s razor and I know how to use it.

      • JohnH2

        Insurance companies should use it as well, right?

        • Reginald Selkirk

          I have no idea what you are trying to say, and probably you don’t either.

  • ncovington89

    I agree with you completely about this. Any adult who really wanted to know the truth on the creation/evolution debate could do a simple google search, or read one of ten thousand books available on the subject. So, there’s no point in debating these folks anymore.

  • eric

    Now I’m going to sit here trying to think up phrases that create funny double entendres when disemvoweled. Damn you!! :)

  • Rain

    It did this to me on Cygwin:

    ./disemvowel 2.py: line 4: syntax error near unexpected token `(‘
    ‘/disemvowel 2.py: line 4: ` text=input(‘Enter text to disemvowell or special command: ‘)

    I have no clue why. Dunno a thing about that stuff. I don’t even know why I have “Cygwin”. I thought it might be of interest that it said that though.

    • Rain

      Actually I do know why I have Cygwin. It’s because the text tools and editors are so bleepin cool but I don’t want to have Linux.

    • http://patheos.com/blogs/hallq/ Chris Hallquist

      Dunno either. I have to open the script in IDLE (Python’s GUI) and run it there in order to get it to work. It also runs in the command line, but I can’t copy and paste text in and out of the program’s window when I run it that way.

      • Rain

        I forgot to tell it that python is supposed to run it. I thought I could just type the script name by itself–in which case the “bash” command shell would think that it is meant for bash itself to run instead of python.

      • Amakudari

        It’s because Python user input changed a bit between 2 and 3. If you have 2 (the status quo), you should be using raw_input instead; input(…) is equivalent to eval(raw_input(…)), that is, it executes user input as a block of Python code.

        If you have 3, I think input() became the new raw_input(). I’m not a Pythonista, but my understanding is that it has more than a few breaking changes.

        A few pro-tips to a beginner:

        * I’d use Unix-style line endings if possible (instead of Windows). On OSX, Linux, etc. this fails for that reason.
        * Other conventions: for constants like stockWarning_1 I’d go with SCREAMING_SNAKE_CASE, and if you don’t have a stake in the holy war that is tabs vs spaces, the most common indentation style with Python is 4 spaces.
        * It’s a bit early, I guess, but regular expressions are very useful for string manipulation, and this is a very appropriate use case. You can condense all that character checking into a single statement. At the top you would import the library with

        import re

        and during the string-checking-and-selecting-character-by-character part you could do

        print re.sub(r’(?i)[aeiou]‘, ”, text)

        that is, in text replacing a, e, i, o and u, where (?i) makes it case-insensitive, with a blank string.

    • J. J. Ramsey

      I do. I can reproduce the error by doing “chmod +x disemvowel 2.py” and then typing “./disemvowel 2.py”. The problem is that the shell then tries to read and execute instead of Python. The first three lines are syntactically correct Bourne Again shell, but the fourth is not. To get the script to work, you can

      (1) run it as “python disemvowel 2.py”, or

      (2) first add “#!/usr/bin/env python” as the first line of the script, and then run it through the dos2unix utility. (I found that if you don’t do the latter, the shell thinks the carriage return character at the end of the line is part of the interpreter that’s supposed to execute the rest of the script.)

      FWIW, I tested this on OS X, but it should work on any platform with Python that behaves “Unix-y” enough.

      • Rain

        Thanks J. J. Ramsey. I completely forgot that a script on “Unix-y” platforms needs to be told which interpreter is supposed to run it. Been a while! I also had to change

        text=input(‘Enter text to disemvowell or special command: ‘)

        to…

        text=raw_input(‘Enter text to disemvowell or special command: ‘)

        to get it to work for me (on cygwin anyway). Cool script.

        • J. J. Ramsey

          I found that the difference between the “input()” and “raw_input()” functions for me is that with “input()”, I have to wrap my input in quotes, while with “raw_input()”, I don’t.

  • Reginald Selkirk

    Ths s n trg!

  • http://nolscuriosity.wordpress.com/ Nolan

    codeacademy.com is another good source for learning different programming languages, and it looks like they do have Python listed as well. I haven’t tried any of their Python courses yet, but I’m pretty happy with my html and javascript skills now.

  • Physeter

    Wht f crtnsts lrn 2 spk wth n0 vwls? Ntrl slctn wns agn!


CLOSE | X

HIDE | X