• (cs)

    Popen(['echo', 'Frist!']);

  • Developer #6554781 (unregistered) in reply to Iwamori

    Snailcond!

  • Anonymous (unregistered)

    Duplicate of [insert article link here]

  • Anonymous (unregistered)

    It would be better if it is more generic.

    i.e. implement *sh in Python

  • davesol (unregistered)

    TRWTF is Chris. He's got some juniors in on work experience and just left them to get on with writing code with no guidance from him. What did he expect?

  • (cs)

    Chris is indeed TRWTF... I work a lot with interns, and if I gave the instructions (As presented in the article) and got back something different than what was posted I would have been unhappy.

  • (cs)

    Chris is indeed TRWTF... I work a lot with interns, and if I gave the instructions (As presented in the article) and got back something different than what was posted I would have been unhappy.

  • Pista (unregistered) in reply to Anonymous
    Anonymous:
    Duplicate of [insert article link here]

    ... of http://thedailywtf.com/Articles/Best-of-Email-Brains,-Security,-Robots,-and-a-Risky-Click.aspx

  • Colin 't Hart (unregistered)

    TRWTF is why replace a concise shell command with lots of Python code.

  • TopTension (unregistered)

    Running low on WTFs, so we are supposed to chuckle about juniprs from school?

  • Anonymousy (unregistered) in reply to Colin 't Hart

    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

  • Tim (unregistered)

    And here lies the entire problem with the way programming/computer science is taught in college. You see Dudley was taught that he will always be given the exact description of what the issue/project is and he should never go above that

  • nizzle (unregistered)

    TRWTF is that neither the original nor the Python port can handle files with spaces in the name. Well, the Python port at least handles that for the directory passed to find.

    find "$1" -name '*.[c]' -print0 | xargs -0 pmccabe | awk '{ print $1, $4, $5, $6, $7 }'
  • free beer (unregistered) in reply to Anonymousy
    Anonymousy:
    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

    gives beer

  • fatfacemcfattypants (unregistered) in reply to nizzle
    nizzle:
    TRWTF is that neither the original nor the Python port can handle files with spaces in the name. Well, the Python port at least handles that for the directory passed to find.
    find "$1" -name '*.[c]' -print0 | xargs -0 pmccabe | awk '{ print $1, $4, $5, $6, $7 }'

    Find with "$1" will handle spaces in the name. "" is a bit magical with arguments. I've not studied it in detail but in practice I've found it will always map to a single argument in bash. Otherwise you would have to ask yourself why all these scripts with "$VAR", wouldn't that be redundant?

    Following the find the string manipulation would easily be handled by python with basic knowledge and the recursive directory search would only require one step up on knowledge but the real questions is what the hell pmccabe does.

  • Np (unregistered)

    Are intern coding fails acceptable to be posted here? Seems like it would be in the same bucket as student/non-professionals.

    They are going to make mistakes. You shouldn't shame them for that. And if you want them to port code then you need to be clear that it shouldn't be a direct port. I frequently do a direct port on my first iteration just to ensure the output will match.

  • fatfacemcfattypants (unregistered) in reply to fatfacemcfattypants
    fatfacemcfattypants:
    nizzle:
    TRWTF is that neither the original nor the Python port can handle files with spaces in the name. Well, the Python port at least handles that for the directory passed to find.
    find "$1" -name '*.[c]' -print0 | xargs -0 pmccabe | awk '{ print $1, $4, $5, $6, $7 }'

    Find with "$1" will handle spaces in the name. "" is a bit magical with arguments. I've not studied it in detail but in practice I've found it will always map to a single argument in bash. Otherwise you would have to ask yourself why all these scripts with "$VAR", wouldn't that be redundant?

    Following the find the string manipulation would easily be handled by python with basic knowledge and the recursive directory search would only require one step up on knowledge but the real questions is what the hell pmccabe does.

    My mistake you modified the original.

    Turns out... https://pypi.python.org/pypi/mccabe

  • XXXXX (unregistered)

    I am confused... Why do you need python for a web front-end?

    My first web-programming gig back in the 90s was Perl.

    You can put a web front-end on Perl without breaking a sweat.

    So instead of just putting a web-interface onto the perl scripts, they decided to throw their perl away because ????

  • Chris P. Peterson (unregistered) in reply to davesol

    Agreed.

  • Throknor (unregistered) in reply to XXXXX
    XXXXX:
    I am confused... Why do you need python for a web front-end?

    My first web-programming gig back in the 90s was Perl.

    You can put a web front-end on Perl without breaking a sweat.

    So instead of just putting a web-interface onto the perl scripts, they decided to throw their perl away because ????

    Pfft. My first web back end in the 90s was MUMPS. And, as I recall, it included an image map.

    Good times.

  • борис (unregistered)

    Writing it the long way lets you put comments behind each line so you know what each character is supposed to do.

    TRWTF is no comments.

  • Chris (unregistered)

    Making fun of interns is really lame.

  • EatenByAGrue (unregistered)
    Why do you need python for a web front-end?
    You don't need Python, but you need something, and Python is a pretty good one, with an MVC framework (Django) and at least one CMS (called Mezzanine).

    Now, as to why you need to convert everything from Perl, you don't have to, but it sure can make the jobs of the sysadmins and maintainers easier. Also, Python code is significantly more distinguishable from line noise or the output of /dev/random ducks.

    A note on dealing with interns: The point for the employer is to find good entry-level hires in a low-stakes situation that makes it easy to get rid of the idiots. That means that the ones that aren't going to make the cut are often real dunderheads, and should be treated as such.

  • nitePhyyre (unregistered) in reply to Tim
    Tim:
    And here lies the entire problem with the way programming/computer science is taught in college. You see Dudley was taught that he will always be given the exact description of what the issue/project is and he should never go above that
    Nah, that's how "entry level" works in any field.
  • (cs)

    Dudely is smart and knowing when to reivent wheel and when not to.

  • (cs) in reply to Colin 't Hart
    Colin 't Hart:
    TRWTF is why replace a concise shell command with lots of Python code.

    Yes. This is because a lot of developers are afraid of *nix systems. Nobody will admit this, but I have seen and heard this with my own eyes and ears.

  • (cs) in reply to Chris
    Chris:
    Making fun of interns is really lame.

    In america are not interns making coffee? if you make of them, they will spit in your coffee.

  • Hannes (unregistered) in reply to Anonymousy
    Anonymousy:
    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

    And give two to me, or else leave me be!

  • prefec2 (unregistered)

    TRWTF is not to use existing tooling, comparable to Checkstyle (http://stackoverflow.com/questions/2977866/checkstyle-for-python). Even as a stupid college student, you should know a) look if someone already solved the problem b) if yes, test if it works and is maintained c) if yes, use it, else discuss finding with supervisor

  • (cs)

    TRWTF is "E for effort".

    E???

  • (cs)

    I'm surprised nobody has complained about

    'awk', ('$1 > %d' % max_limit)
    in the Python script, but not in the original shell. Nor that
    max_limit
    isn't defined anywhere. I don't know Python (refuse to learn), but I could at least make that out.

  • Nick Hristov (unregistered)

    Maybe Chris should have been a bit more expressive about his expectations when talking to a junior programmer? After all, Dudley did exactly what he was asked to do.

  • (cs) in reply to XXXXX
    XXXXX:
    I am confused... Why do you need python for a web front-end?

    My first web-programming gig back in the 90s was Perl.

    You can put a web front-end on Perl without breaking a sweat.

    So instead of just putting a web-interface onto the perl scripts, they decided to throw their perl away because ????

    You can use VB on the web, doesn't mean it's a good idea.

  • Tux "Tuxedo" Penguin (unregistered) in reply to Chris
    Chris:
    Making fun of interns is really lame.
    Said intern.
  • (cs) in reply to realmerlyn
    realmerlyn:
    I don't know Python (refuse to learn), but I could at least make that out.

    I don't wanna learn, see?

    The more you code, the less intelligent ya are.

  • MrOli (unregistered) in reply to fatfacemcfattypants
    Find with "$1" will handle spaces in the name. "" is a bit magical with arguments

    It's not magic. This will handle spaces just fine because it has been written to.

    Find will output any files matching the criteria, normally separated by a newline, which would be seen by other commands as whitespace and would confuse things if the filenames had spaces in. The "-0" will make it output the files separated by a NULL char instead of newline. This feature of find is explicitly and deliberately to solve this issue.

    the "-0" on xargs will make it expect the input strings be terminated by NULLs instead of newlines, and it will split the input on the NULLs to get an array of arguments, some of which will contain newlines.

    When it forks and execs "pmccabe", it simply passes this argument array in.

  • Stimpy (unregistered)

    I love how all errors are sent to DEVNULL, then at the end, he goes back and checks for errors.

  • DigDug (unregistered)

    Duds are no different from live shells, except someone forgot to set the fuse.

  • (cs) in reply to Zylon
    Zylon:
    TRWTF is "E for effort".

    E???

    Could be referring to the "E/G/S/N/U" grade scale (standing for "Excellent"/"Good"/"Satisfactory"/"Needs-improvement"/"Unsatisfactory") used in place of "A/B/C/D/F" by some elementary schools.

    Alternatively, it's a grade between "D" and "F".

  • deleted (unregistered) in reply to XXXXX
    XXXXX:
    I am confused...

    ...by The Daily WTF. All is in order.

  • Butthats 4Eva (unregistered) in reply to Hannes
    Hannes:
    Anonymousy:
    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

    And give two to me, or else leave me be!

    And I will take four, or boot your ass out the door!

  • Name (unregistered)

    TRWTF is expecting someone with zero real world experience to have in depth knowledge of both languages and be able to not just translate the literal code but the intent behind it. Chris is the dud here in managing people.

  • (cs) in reply to Javelin
    Javelin:
    Zylon:
    TRWTF is "E for effort".

    E???

    Could be referring to the "E/G/S/N/U" grade scale (standing for "Excellent"/"Good"/"Satisfactory"/"Needs-improvement"/"Unsatisfactory") used in place of "A/B/C/D/F" by some elementary schools.

    Alternatively, it's a grade between "D" and "F".

    In some universities, "E" is "Conditional Failure", meaning that the student can meet with the professor who will set conditions for upgrading to a "D".

  • (cs) in reply to chubertdev
    chubertdev:
    XXXXX:
    I am confused... Why do you need python for a web front-end?

    My first web-programming gig back in the 90s was Perl.

    You can put a web front-end on Perl without breaking a sweat.

    So instead of just putting a web-interface onto the perl scripts, they decided to throw their perl away because ????

    You can use VB on the web, doesn't mean it's a good idea.

    snoıʌqo sı ןןoɹʇ snoıʌqo

  • (cs) in reply to tharpa
    tharpa:
    Javelin:
    Zylon:
    TRWTF is "E for effort".

    E???

    Could be referring to the "E/G/S/N/U" grade scale (standing for "Excellent"/"Good"/"Satisfactory"/"Needs-improvement"/"Unsatisfactory") used in place of "A/B/C/D/F" by some elementary schools.

    Alternatively, it's a grade between "D" and "F".

    In some universities, "E" is "Conditional Failure", meaning that the student can meet with the professor who will set conditions for upgrading to a "D".

    You can meet with professor only if your sex is opposite to that sex of the professor.

    Not that I am doing any such things here.

  • (cs) in reply to Butthats 4Eva
    Butthats 4Eva:
    Hannes:
    Anonymousy:
    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

    And give two to me, or else leave me be!

    And I will take four, or boot your ass out the door!

    I'm having eight Fuck, I am in a state

  • (cs) in reply to Nagesh
    Nagesh:
    tharpa:
    Javelin:
    Zylon:
    TRWTF is "E for effort".

    E???

    Could be referring to the "E/G/S/N/U" grade scale (standing for "Excellent"/"Good"/"Satisfactory"/"Needs-improvement"/"Unsatisfactory") used in place of "A/B/C/D/F" by some elementary schools.

    Alternatively, it's a grade between "D" and "F".

    In some universities, "E" is "Conditional Failure", meaning that the student can meet with the professor who will set conditions for upgrading to a "D".

    You can meet with professor only if your sex is opposite to that sex of the professor.

    Not that I am doing any such things here.

    Yes of course. Same-sex shenanigans is frowned upon where you come from, innit?

  • Yuri (unregistered)

    Yay! No Discourse :)

  • Yuri (unregistered) in reply to Matt Westwood
    Matt Westwood:
    Butthats 4Eva:
    Hannes:
    Anonymousy:
    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

    And give two to me, or else leave me be!

    And I will take four, or boot your ass out the door!

    I'm having eight Fuck, I am in a state

    Sixteen for me, ("I have a problem", you see..)

  • Piss Head (unregistered) in reply to Yuri
    Yuri:
    Matt Westwood:
    Butthats 4Eva:
    Hannes:
    Anonymousy:
    "TRWTF is why replace a concise shell command with lots of Python code."

    Hear hear, give this man a beer!

    And give two to me, or else leave me be!

    And I will take four, or boot your ass out the door!

    I'm having eight Fuck, I am in a state

    Sixteen for me, ("I have a problem", you see..)
    I'll take thirty-two, Of your wonderful brew!

Leave a comment on “Literal Scripting”

Log In or post as a guest

Replying to comment #:

« Return to Article