Hacker News new | past | comments | ask | show | jobs | submit login
Advanced Data Structures in Python (pypix.com)
41 points by pypix on Dec 18, 2013 | hide | past | favorite | 10 comments



Those aren't data structures.


I was going to write the exact same thing


Thanks for your insight.


The article should be called, "Short descriptions of pythonic constructs, some of which should be generally avoided to reduce unnecessary complexity."


I disagree. These are constructs that you should try to use more often whenever the design pattern fits what you are trying to achieve. They only seem complex when you first encounter them but after you actually learn these design patterns, you will see that it simplifies your code.

The genius of Python is that it is not merely a very clean and clear programming language, but it provides optimized execution for various design patterns as long as you tell Python that is what you are doing. When you write a for statement (or while) with an index which is incremented and tested, your loop will run much slower than it would in C, because you aren't cooperating with Python. But when you tell Python that you have a loop over a certain list of things, then Python can execute that loop as fast as C would because the loop itself is actually written in C inside the Python VM. That is what a list comprehension or a generator do for you.

And learning these constructs will help you greatly when you want to fully grok functional programming, monads and functional reactive programming. All of the major languages are evolving towards full functional power, and in many cases they are copying their features from Python after seeing how successful they have been in the Python community. Scala is probably the most notable example that is NOT copying Python because they are blazing new territory. But if you look at the last couple of enhancements in Javascript and what is planned for the future, it looks a lot like Python features.


These are not the data structures you are looking for, move along...

A good source on this subject, with applications, is Steve Hanov's blog (read a year or so back - he started an ISV and his recent scope expanded to include business issues...):

http://stevehanov.ca/blog/index.php


I've been inspired by this article to write a post titled "How to Analyze Big Data in Python" that walks you through how to make pivot tables in excel.


Very interesting article.

Thanks !


Sorry if anything went wrong. I have changed the title.

Advanced Design Patterns in Python.


upvoted you for fixing the title and letting us know about it.

Thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: