Sunday, October 9, 2011

Packing and Unpacking

            This week, we learned some more about the weirdness of Python. Python has named arguments, which means that you can name the arguments in a function call. This is nice because it gives more clarity to the function call if the arguments are meaningfully named. However, this functionality could be a pain if some function header needed to be changed. Changing the function header requires all the function calls to also be changed, which could mean a lot of time-consuming work. Python also gives us the feature of declaring default values for parameters, like C++. And then the weird part comes in. Python can take in an iterable item as an argument, if it is preceded by a *. This iterable item is then unpacked into its corresponding elements. Conversely, python can also pack elements into a tuple, if the function header lists *something as an argument.I am assuming that these are useful features to have in a programming language, since python clearly has them! I haven't thought of a good way to use them yet though.
            On Friday, Professor Downing described the group project that we will be working on for the rest of the semester. I liked the idea of a website that focuses on collecting and imparting information on the current natural disasters. This seems like a project that will have some application in the real world. I have never worked on websites before, and I am excited to begin this project! I hope that working in a group won't be too hard; the git repository at least should make it somewhat easier. We should all remember to push changes frequently though, since merge conflicts are really tedious. I had to face a couple of merge conflicts with git at my internship this summer, and I did not appreciate the time I had to spend to go and fix those. I think working in a team of 5 should be easier than working in a team of 20 though!



    

No comments:

Post a Comment