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

Ante Group Title

Hello guys! I noticed that Guttag uses lists in many cases where - seemingly - tuples would work as well. When I write code I'm trying to avoid mutable data objects whenever it's possible but I was just wondering if there's any particular reason why lists may be preferable in general? (Maybe something about memory requirements? )

  • one year ago
  • one year ago

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

    lists in general are more easier to work and handle......you can easily refer to an element, pop out a element from list , add elements , overwrite elements(replace with new ones) etc. certainly all these features are not available in tuples and lists have an advantage where we need to constantly modify the stored data be it add elements or refer to them. as regarding memory requirements someone else may better answer it

    • one year ago
  2. RONNCC Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    tuples have a memory advantage I think

    • one year ago
  3. RONNCC Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    lists are dynamically sized, tuples are not

    • one year ago
  4. KonradZuse Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    It seems like a tuple would be an array(n-tuple)? I've heard the term in discrete and calc and such. From above it says tuples cannot modify the data within(stacks,queues,etc) but Arrays can... Arrays aren't a list I don't believe.

    • one year ago
  5. shawnf Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    A list takes up more bytes than a tuple, and a tuple is immutable. That would seem to argue for using tuples unless you need to be able to append or assign values to elements. I find lists easier to work with.

    • one year ago
  6. MicroBot Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    not sure why prof. Guttag uses list over tuples but the following link gives some info about their differences and uses. http://news.e-scribe.com/397 hope it helps

    • one year ago
  7. Muscy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Lists vs Tuples is very much about what you need them for, If you want a variable that you do not want to accidentally change use a tuple for constants, (For style, constants variable names are written in uppercase i.e. EARTH_RADIUS = 6 378.1) If you want to change / add to / remove from you need mutability, a list would be better.

    • one year 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.