7 ms·
Why you shouldn't learn Python: 1. In-consistant syntax. 2. The language uses exceptions to control flow of logic. 3. Divided community, since Python 3+ incl
by hacker_9 10y ago
Why you shouldn't learn Python:
1. In-consistant syntax.
2. The language uses exceptions to control flow of logic.
3. Divided community, since Python 3+ included breaking changes to the standard.
4. Un-discoverable APIs. You better hope the documentation is bulletproof else the API could change in any which way during runtime.
5. Poor error messages. If an import goes wrong you are not told why, and so on.
6. Ultimately slow performance for anything marginally complex.
7. Poor tooling.
- lcnmrn 10y agoName a single language that covers all those things and has a pretty syntax.
- ben_jones 10y ago01000010 01101001 01101110 01100001 01110010 01111001 00111111 00001101 00001010?
- dpatru 10y agoBinary?
- omginternets 10y ago1
- jeffwass 10y agoYou had me until the CR LF, but clearly the true hacker's choice is just the LF. <ducks>
- dalke 10y ago10010 10202 11020 11002 10121 11020 11111 01020 00101
- enrmarc 10y agoIMHO Ruby is a good candidate.
- lmm 10y agoScala. (Which is why I use it)
- pjc50 10y ago8. Significant whitespace. Not only is it a constant minor inconvenience when editing the program, it makes it very hard to cut-and-paste code fragments on the web.
- rglullis 10y ago"Making it hard to copy-paste code from the web" is something that I would consider a feature, to be honest.
- dalke 10y agoSome similar failure cases are: 1) when I make a presentation using Keynote, it drops the leading spaces when it exports to PDF, so my students can't simply copy/paste my example code. 2) the interpretation of blank lines with no indentation on the repl means "end of current code", which is different than in a .py file. This means if I copy&paste from my in-development code to the repl, I can get syntax error unless I carefully ensure that all blank lines inside of indented code blocks are also indented.
- rglullis 10y agoFor (2), ipython and %cpaste are your friends.
- dTal 10y agoI've never understood this complaint. Whitespace is included when you copy something. What's the problem? Admittedly it is mildly annoying when someone decides to use some random number of spaces for indentation, and you have to fix it to make it match the rest of your code (my preferred editor, Geany, has a feature for this). We should all just use tabs. But "very hard"?
- yoz-y 10y agoThe web collapses whitespace so if the code is not in <pre> tags you are stuck. This is quite often a case where comment systems were not intended to share code.
- wiz21c 10y ago1. a matter of tast 2. care to elaborate ? 3. it's not divided, it's evolving from 2 to 3. Java's community is under Oracle's grip, don't know if it's any better... 4. it's not because you can do it that it's worth to do it, so in practice API are just not changing at runtime 5. I can say the same of my industrial strength Java environment... 6. Not a problem since what you do doesn't require speed 7. Ever used PyCharm ? I wouldn't say it's poor tooling. The debugger is fine. What I miss is something like a good profiler to look at running code. But I'd say : 8. Optional typing should've been there from day one, it'd made code editor, tooling better 9. The date/time handling is not good 10. SOA support is weak (and in the kind of setting I am, we use tons of XSD, WSDL, XML, security, signature you name it)
- kirkdouglas 10y ago> What I miss is something like a good profiler to look at running code. vprof is quite nice: https://github.com/nvdv/vprof https://github.com/nvdv/vprof
- mertd 10y ago#2 is because it is more "pythonic" to ask for forgiveness than permission (EAFP). For example, rather than checking if a dictionary has an element before accessing it, you just try to access it and handle the KeyError if it doesn't. The code reads easier and the normal flow would be faster in this case. When used in EAFP context only, I think it is fine to use exceptions as part of logic in Python. They are relatively less costly compared to C.
- nhumrich 10y agoPyCharm comes with cProfile and let's you "run with Profiler". But maybe that's only the paid version.
- dagw 10y agoYup. The integrated profiler is only in the paid version
- sedeki 10y agoWhat do you mean by inconsistent syntax?
- curiousssly 10y agoCollection library has: deque defaultdict Counter After many years I often write DefaultDict myself. Edit: formatting
- enrmarc 10y agoWhy does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))? http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm http://effbot.org/pyfaq/why-does-python-use-methods-for-some... I guess is that.
- Rotareti 10y ago>3. Divided community, since Python 3+ included breaking changes to the standard. I'm using Python since about half a year and for all I did this wasn't an issue. I just started with 3 and had the feeling everything around me was 3 as well. 3 was released in '08.
- freehunter 10y agoUnless you want to follow a tutorial or use a library. Most are up to 3 now, but not all. And especially with tutorials, the older ones don't always say.
- yoz-y 10y agoWe are hitting the 2/3 divide constantly. In our software we try to support both (for plugins). But it is a mess especially if you want to load interpreters to both at the same time. It is also near impossible to make somebody update from 2 to 3 in the scientific community.
- foxylad 10y ago> 4. Un-discoverable APIs... One of the main reasons I like python is that it is the most self-documenting language I've come across. Say what you like about significant whitespace, but in my last job I used to show salespeople snippets of code and they understood them - with no knowledge of the language.
- icc97 10y agoI agree that the code does document itself well. The biggest problem I have is the docstrings [1] which I find quite weird and find the Javadoc style comments much more readable. [1]: https://www.python.org/dev/peps/pep-0257/
- didymospl 10y ago8. Global Interpreter Lock in CPython
- verbatim 10y agoThis isn't an issue with the language, it's an issue with the common implementation of the language. It will be remedied by either fixing CPython, or by switching to a different implementation. (If neither happens, then I guess it isn't really a problem.)
- whyever 10y ago> This isn't an issue with the language, it's an issue with the common implementation of the language. There is no formal definition of the language. It is defined by the C implementation. So I'm not sure how meaningful that distinction is. > If neither happens, then I guess it isn't really a problem. Or people give up on Python and use another language.
- dalke 10y agoPython is not defined by its C implementation. For example, Python-the-language does not require reference counting even though CPython uses that. The real-world distinction between the Python specification and its implementation started in the late 1990s, with JPython (now Jython).
- didymospl 10y agoI wrote explicitly that this is a problem with CPython. I totally agree that this is not the problem of the language itself. Neither are the most of the points from the parent post(tooling, community, performance, error messages). Yet all that still greatly affects your experience with the language. Same applies to the default implementation. I think you would agree if I said that Sun(Oracle) JVM played an important role in Java adoption, wouldn't you? Unfortunately, it's not so easy to just switch to some other implementation of Python: PyPy uses GIL as well, IronPython and Jython don't but they are years behind the current version of the language. GIL is not a problem when you use libraries that handle concurrency natively(e.g. NumPy) but when you try to parallelize some computationally intensive algorithm written in Python you're probably going to hit the wall. I love Python but it's really not a one-size-fits-all tool.
- typon 10y agoReasons to learn Python: Sklearn, tensorflow, pandas, Sqlalchemy, requests, Beautifulsoup, numpy, scipy, pulp. If you have a language that had equivalent libraries that cover all these domains I'd love to hear it. Until then I can build really cool stuff in Python very easily thanks to the amazing hardwork and generosity of these library creators.
- neurostimulant 10y agoYup. For engineering and data science Python seems to be the best choice right now.
- gone35 10y agoIf you have a language that had equivalent libraries that cover all these domains I'd love to hear it. R[1]. [1] https://cran.r-project.org/ https://cran.r-project.org/
- 0xCMP 10y agoOkay, but I'm not sure they wanted to go from python to R. The issues listed in the original post are definitely not fixed in R. And you lose out on python's ability to also be used for other things.
- typon 10y agoThe problems people have with Python are magnified at least 10x on R.
- omginternets 10y agoYou can't possibly claim that the R language is better-designed that python...
- pthreadses 10y agoWeird, I actually consider Pythons consistency in syntax to be a positive. And it's continually becoming more so.