Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

pdpinch Group Title

Are list comprehensions in Python worth the effort? They seem like fun brainteasers, but once I write the code down it looks illegible to me -- even it works. It reminds me of some of the unmaintainable code I wrote in Perl years ago.

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. Screech Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    That's why the "comment" statement was invented. Just because the code works doesn't mean your job is done. Arcane coding should also include some explanatory comments to help out the next programmer to come along (which might be yourself in 6 months).

    • 2 years ago
  2. Shadowys Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Aye, you can use comments to explain it. List comprehensions save a whole lot of space and speed, ideal for some very complex programming.

    • 2 years ago
  3. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Perl code, unmaintainable?? :-)

    • 2 years ago
  4. Screech Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I never found Perl unmaintainable. In fact, after a bit of effort, it became easy to read and I always had to remind myself that others were not coming in with the same background. Thus, its still a good habit to comment and document techniques which might be tricky or just out of the ordinary.

    • 2 years ago
  5. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Yeah. Like regular expressions....:-)

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.