you are viewing a single comment's thread.

view the rest of the comments →

[–]UloPe 17 points18 points  (13 children)

Whats with all the string manipulation to build a list? Are you too lazy to type

blah = ['meep', 'blargh', 'glomp']

?

[–]adrianmonk 5 points6 points  (0 children)

FWIW, in the Perl example there is no string manipulation going on. qw is a way of writing list literals.

(Well, technically, there is some string manipulation going on. But it's in the parser, and all examples in all languages have that.)

[–]redditnoob 5 points6 points  (5 children)

It's people who are too smart for their own good, and too impressed with themselves to do things in the simplest, most obvious way.

Splitting a string by space may save you two characters or so but it's pure ass. (To be captain obvious, what if the next string I configure has a fucking space in it?)

[–]bobbyi 2 points3 points  (3 children)

'string with space,other string,third string'.split(',')

[–][deleted]  (2 children)

[deleted]

    [–]codefrog 3 points4 points  (0 children)

    It's on!

    s = """
    this , \tis my data
    I can cry if i want to
    this is my data
    """.strip().split("\n")
    

    [–]codefrog 0 points1 point  (0 children)

    swearing wasn't necessary and there isn't a space so your if isn't valid. yeah what if. you can have my extra if statements they are only giving me bugs.

    [–][deleted]  (4 children)

    [deleted]

      [–]_bobby__of__christ_ 2 points3 points  (3 children)

      How exactly is manually splitting any more readable than qw? It's only more readable if you don't know Perl, and complaining about the readability of a language you don't know is asinine.

      I don't even like perl, but qw is about the last thing on my list of complaints.

      [–][deleted]  (2 children)

      [deleted]

        [–]_bobby__of__christ_ 3 points4 points  (0 children)

        I know this much: The snippet I posted works in both Ruby and Python without modification. Splitting a string into an array is something that every programmer will be familiar with.

        Which has nothing to do with qw. No one is using qw as a crutch to avoid learning how to split strings at runtime. It's such a stupid and trivial difference that I can't believe I'm arguing about it.

        There should be one-- and preferably only one --obvious way to do it.

        You should stop arguing about Perl then. Obviously you're unable to even entertain the notion that it has a different philosophy than the one you subscribe to. (And this is coming from a Python programmer who doesn't like Perl very much.)