[1]: https://docs.djangoproject.com/en/1.5/intro/tutorial05/
[2]: https://docs.djangoproject.com/en/1.5/intro/reusable-apps/
222 karma · joined September 12, 2011
[1]: https://docs.djangoproject.com/en/1.5/intro/tutorial05/
[2]: https://docs.djangoproject.com/en/1.5/intro/reusable-apps/
[1]: http://stackoverflow.com/questions/514371/whats-the-bad-magi...
BTW, as much as I am amazed to see websockets in action, the real time updating of vote count feels creepy and distracting at the same time :-)
dict((k, []) for k in keys)
Although I later realized what I really needed was defaultdict[1] d = defaultdict(list)
[1]: http://docs.python.org/2/library/collections.html#collection...Not in my opinion. Here is my personal experience of using this site when I was just starting with Python. I had landed up there looking for a function similar to PHP's `array_fill_keys`. And it showed me `dict.fromkeys(keys, value)`[1] without a slightest of warning that unexpected things will happen if its passed a mutable data structure such as an empty list as the value.
So IMO, for people coming from PHP background writing some of their first Python code, it can be helpful at times but not an alternative to learning Python from a book or some serious online resource. Moreover, the site itself says that it won't teach you either PHP or Python.[2]
[1]: http://www.php2python.com/wiki/function.array-fill-keys/ [2]: http://www.php2python.com/about/
Totally agree with this.
After getting super impressed by Django's South migrations[1] app, I wrote a minimal migrations tool[2] for PHP-MySQL projects without checking if solutions already existed :-). Used it in two projects and it made life a lot easier for me and the team.
This looks much better though. Will definitely give it a try for my next PHP project.
I don't subscribe to the idea of landing pages for non existent products but I feel that if lot of new products start showing such a message when there aren't many technical reasons to do so, no one is going to believe about the queue thing anyway. OTOH, people might start using it as a filter instead!
Not really, I think length of indentation affects the length of the line only if there is a lot of nesting. For HTML I use 2 spaces as I know there is going to be a lot of nesting, whereas in JS, not so much, so 4 spaces works perfectly for me. Also, in JS, chained function calls be aligned on multiple lines which makes it more readable as well.