Hi Everyone,<p>First of all, thank you all for your comments. I have to clarify the purpose of this library. I'm originally a JavaScript developer and I didn't write a single line of python code before this project.<p>I needed a project to learn python and I choose something I'm already familiar with. Underscore.js has almost everything you want to learn on a new language and it thought me a lot.<p>When I completed the project I figured I can post it online and other clueless javascript developers like myself can learn python from a familiar place.<p>I'm fully aware that python already has most of the tools underscore has and this code is not pythonic at all. It was built that way intentionally. I wanted it to be the same as underscore.js.<p>Now I need your advice to write a better python code and maybe create a useful library after all.<p>Thank you all.<p>PS: I wrote this comment from mobile phone so please excuse any errors.
I hesitate to add to the negative response to what is surely a well-meaning free project for the world. But `_` is really a poor choice for a variable name in Python. It is already used as:<p>* the value of the last expression in the REPL<p>* a conventional abbreviation for `gettext.gettext` (<a href="http://docs.python.org/library/gettext.html" rel="nofollow">http://docs.python.org/library/gettext.html</a>)<p>* a conventional throwaway variable (for `str.partition` and other functions that return a larger tuple than you want)<p>And for most of these features, invoking them through a object/class method rather than a standalone function is unwieldy (and unpythonic)
It is hilarious that someone would have the knowledge to build this but not know that it was already implemented as part of the language.<p>Is this a parody?
Most of the methods provided are functions already built into Python (map, filter, reduce, all, any, min, max)<p>Also the underscore variable name conflicts with the common convention of using an underscore as the i18n translation function.<p>Those issues aside, the templating looks handy, and I'm sure the whole thing was fun to write.
<p><pre><code> VERSION = "0.1.2"
"""
Version of the library
"""
</code></pre>
This is a good example of unnecessary commenting.<p>But I think this port misses the point of Underscore.js, which is to make the same functional features of the language available to all browser implementations, because not all browsers have forEach, or filter, or reduce, etc. In Python, or other languages? The features are already there.
There is absolutely no reason to use this. As far as I can tell, it's a direct port of underscore.js, and implements nothing but functionality that's already in python.
My opinion: Anytime you share code by posting it publicly, you should always be prepared for negative feedback. In some cases that might be the whole point of posting it: you want to learn from your mistakes.
Good job! I know that some of these functions maybe have already occurred to Python developers (map et al), but this probably lead you to a broader understanding of underscore.js itself.
While I can understand this might have been fun from a hacking/building experience, I don't understand why do it. Everything except the micro templating already exists in python.
This doesn't bring anything good to Python. Python can do those things nicely. I can't see any point of this library. Also, underscore already has its meaning in some places, such as for i18n. For example, _('Text to be localized'). Another use of underscore is to store the previous output in console. Although you can rename it, still, it's pointless.