6 ms·
If you learn to like Python, you will learn to hate other languages. :) The stdlib. It has some great parts and overall is just good enough (and desire to not
by njharman 14y ago
If you learn to like Python, you will learn to hate other languages. :)
The stdlib. It has some great parts and overall is just good enough (and desire to not break everyone's code) to not cause revolt and wholesale replacement.
FTPlib is atrocious.
httplib/urlib mess -> requests
os os.path, shutil subprocess is a ridiculous mish-mash of legacy, obscurity and surprising behavior. One example. os.mkdir (but only the leaf, and exception if it exists), want mkdir -p behavior. Is that an option to os.mkdir, fuck no! We need a whole new function for such dramatically different feature. Must be called mkdirs, fuck no! That would be too easy to remember and no one every look at our beautiful docs. os.makedirs is the obvious choice.
- masklinn 14y agoMy biggest issue at this point is the implicit scoping. I've been using Python for 8 years (as well as a bunch of other languages, both for work and personally), and — while a lost cause, it won't be changed at this point — I've come to believe it was a Really Bad Idea[0]. Not only does it make bindings awkward (and sometimes broken, in different ways depending on the way "scope inference" is implemented) and tends to hide errors (e.g. typo) or generate them much later than possible (even though lexical checking is very cheap to perform at parse time, with explicit scopes), it has pretty much no actual benefit I can think of. Especially in Python where assignment is a statement, not an expression, so it's not like explicit scoping would prevent putting assignments in place they're currently allowed. [0] and it's one of the things I find utterly retarded in coffeescript.
- emidln 14y agoassignment is a statement if you want it to be, but you can generally use setattr() as well. E.g. modifying global scope as an expression: import sys module = sys.modules[__name__] def foo(k,v): setattr(module, k, v) foo('spam','eggs') assert(spam == 'eggs')
- masklinn 14y agoThat only "works" for the global scope, or by chance in some cases in the local scope if you do a star-import within the local scope (yeah…) I don't consider that working, it's a piling up of hacks. Which is great when you need them and they work, but... Also, there's a simpler way to implement your snippet: globals().__setitem__('spam','eggs')
- deleted 14y ago[deleted]
- dalke 14y agoI can't tell if the last bit is being sarcastic on bad naming, or it's an oversight: the function you want is called os.makedirs http://docs.python.org/library/os.html#os.makedirs http://docs.python.org/library/os.html#os.makedirs and has been around since 1.5.2.
- aptwebapps 14y agoIt's sarcasm. njharman would have preferred mkdirs.
- masklinn 14y agoor `mkdir(p=True)`, maybe
- dalke 14y agoAhhh! I couldn't see the difference between 'mkdirs' and 'makedirs'. Thanks.
- njharman 14y agoActually I'd preferred something object oriented with option to ignore existing and make all intermediate parts Path.make(force=False) 2nd choice: makedir(force=False) 3rd choice: makedir() and makedirs() Never ever would I want/expect two related functions one abbreviated one not. Yes, I know history of why it's called mkdir. Should learn from history, not repeat it.
- Alex3917 14y ago"If you learn to like Python, you will learn to hate other languages." I think it would be more accurate to say that if you learn other languages, you'll learn not to hate Python. Python is kind of mediocre in a lot of ways, but it's the only language without any deal breakers.
- davidp 14y ago> it's the only language without any deal breakers Interesting thought. Can you elaborate?
- Alex3917 14y agoYou can use it to make websites, do scientific computing, NLP, email processing, datamining, big data, etc. If you're just trying to throw up a website then Ruby or Javascript are fine, but if your backend involves lots of different types of computing then Python is pretty much your only option. So if you have an idea for a minimum viable product but you don't really know where you want to take it two or three years down the road, then it really just seems like the most pragmatic option.
- fauigerzigerk 14y agoTrue, but it has to be said that for NLP, scientific computing and datamining, Python is used as a job control or glue language. The actual algorithms can't be written in Python and that is Python's biggest drawback for me.
- pbiggar 14y agoClojure also lacks deal breakers. Python was my least hated language until Clojure.
- fauigerzigerk 14y agoFor some people the JVM is a deal breaker. I can't say it's a deal breaker for me, but I do understand some of that sentiment. You can't write command line tools in any JVM language because of that long startup and warmup period, and you're always going to suffer from excessive memory consumption. Also, lack of easy access to C/C++ code is problematic for some types of software.
- whalesalad 14y agoI'd like to think/hope that no one would ever judge a language on it's FTP library =)