6 ms·
And still not using python3.X …
by ghost91 11y ago
And still not using python3.X …
- volent 11y ago"A programmer may try to get you to install Python 3 and learn that. Say, "When all of the Python code on your computer is Python 3, then I'll try to learn it." That should keep them busy for about 10 years. I repeat, do not use Python 3. Python 3 is not used very much, and if you learn Python 2 you can easily learn Python 3 when you need it. If you learn Python 3 then you'll still have to learn Python 2 to get anything done. Just learn Python 2 and ignore people saying Python 3 is the future." I don't think it is useful for a beginner to start with python3.
- ghost91 11y agoNearly all packages are ported to python3. There are still some bigger projects missing, but these are exceptions and not the norm. Python3 simplifies many aspects of the language, for example handling of bytes and handling different encodings. In my day to day use I don't want to miss these features. Many interesting features where added in 3, like yield from, more powerful generator syntax and the libraries multiprocessing and pathlib.
- cookiecaper 11y agoWell, this quote is a little pessimistic because now almost everything is either Python 3 compatible or has been replaced with something that is and it's only been 7 years. :P Even NumPy and SciPy work on Python 3 now, and it's not like there are massive differences between Py2 and Py3 anyway, so generally speaking it shouldn't be hard for a noob to revert to Py2 if it becomes inexplicably necessary. It's time. All new code should be in Python 3.
- falcolas 11y agoCall me when I can get system packages for all of these libraries (particularly those with shared library dependencies) in Python3. It will happen someday, but not yet.
- davidshepherd7 11y agoI can't find a publication date for the first version, but since the second edition [was published in 2010](http://webcache.googleusercontent.com/search?q=cache:eW9X2nOXSjgJ:https://lpthw.readthedocs.org/en/latest/intro/+&cd=2&hl=en&ct=clnk&gl=uk&client=ubuntu http://webcache.googleusercontent.com/search?q=cache:eW9X2nO...) I suspect it's now been nearly 10 years since that statement was written.
- lmm 11y agoIt is very useful for a beginner to start with python3, as python3 makes the difference between strings and byte sequences much clearer. The majority of python code on my computer is now python 3.
- teach 11y agoIf you're worried about the distinction between strings and byte sequences, you're thinking about a different sort of "beginner".
- lmm 11y agoA beginner will want to read and write files pretty early on. In Python 2 it's very easy to e.g. ignore that you need to pass the 'b' option for reading binary files and write scripts that seem to work, and then silently corrupt data when run on windows. Which is not a good experience.
- collyw 11y agoI have my main work database / Django project in Python 2. I have a few smaller projects I have started since then - I used Python 3. There are very few noticeable differences. Why would you not start with a more up to date version. Unless there are specific packages you need or expect to need that are not supported I would say Python 3 makes more sense.
- ptx 11y agoPython 3 is useful for a beginner to start with because they don't have to learn the deprecated cruft that Python 2 preserves for compatibility. If they just learn the Python 3 way of doing things, it generally works in both 2 and 3. In his explanation of classes he has several paragraphs about old-style vs. new-style classes, ending it with: "Just completely ignore the idea of old style versus new style classes and assume that Python always requires (object) when you make a class. Save your brain power for something important." Python 3 only has new-style classes, so the entire explanation could have been left out, allowing the beginner to, as he recommends, focus on more interesting things. Another example is his advice, in exercise 11, to avoid the input() function because of its security problems. Python 3 doesn't have that function, so the beginner doesn't have to remember to avoid it. And of course, there's Unicode, which this book seems to completely ignore. A beginner starting with Python 3 has to learn the "Unicode sandwich" approach[1], which applies very well to Python 2 code as well. But someone starting with Python 2 can easily be confused about the concept (because the language is confused) and will have a hard time getting things to work correctly. For example, the book recommends that people "from another country" set their source encoding to UTF-8 – good luck printing things on Windows. [1] https://www.youtube.com/watch?v=sgHbC6udIqc https://www.youtube.com/watch?v=sgHbC6udIqc
- rcthompson 11y agoNo one's saying that Python 3 doesn't improve on Python 2 in significant and tangible ways. The key phrase is "If you learn Python 3 then you'll still have to learn Python 2 to get anything done" which is absolutely true in my experience.[1] This is because as soon as you hit a single dependency that doesn't support Python 3, you have to switch to Python 2. And there are still a good number of important modules that are Python 2 only. (And no, reimplementing the functionality of dependency oneself is not an option for a beginning programmer.) And even if all the modules you need right now are available for Python 3, you might find later that the new feature you want to implement in an existing program requires a Python2-only module. No matter how great Python 3 is, and how much we all wish we could switch to it, we can't just will all our dependencies to add support for it. [1] Obviously your experience may vary depending on which modules are considered essential for your work.
- 11y ago
- kej 11y agoWouldn't this argument preclude using anything new, ever? Don't use C++14 until all of your code is converted to use it. Don't touch ES6 until you throw out your legacy JavaScript. Some of these programs haven't been updated to use Linux-specific features, so let's all stick to UNIX System V. If anyone is best in the position to take up the bleeding edge with no thought to backwards compatibility, it's the people just starting out. They're the ones who, by definition, don't have legacy code to maintain.
- witty_username 11y agoI've been using Python 3 for stuff and pretty much everything is there on Python 3. (django, flask, pillow instead of PIL, etc)
- koshak 11y agoit is. regardless of python3 progress. But nowadays it's easier to name the project that does not support python3 http://py3readiness.org/ http://py3readiness.org/
- panglott 11y agoThat nearly all good intros to Python for non-programmers insist on teaching only Python 2.x, because Python 2.x is what's used in lots of advanced programs and production code, is an attitude that I've found very unhelpful as a beginner. True beginners don't need to use numpy and run a bunch of production-ready libraries. They first need to learn what libraries ARE and the basics of using them. Besides, numpy &c. can already run on Python3, how much further will they be along in 1-3 years? Most simple Python3 programs work fine in Python 2.7.9 with little wrangling, and it's not hard to keep two installs of Python. "Learn Python" right now means "learn both", only many introductory tutorials will refuse to teach both. Instead they'll compound your frustration by making you learn the intricacies of Python 2's print statement instead of print().
- prof_hobart 11y agoIs anything? I've recently decided to start learning Python and started with the assumption that Python 3 would self-evidently be the sensible thing to do. I tried that for about a week before discovering that about 90% of the libraries that I wanted to play with, and 90% of the tutorials and StackOverflow answers that I found were 2.7-specific.
- zedshaw 11y agoI have to serve the student's needs before any in the community, and there's a very practical reason for going with Python2: The vast majority of code out there is in Py2, so if someone learns Py2 first, they can start coding and doing stuff right now. If they stumble onto a need for Py3 later, then they would have the skill to learn Py3 from the tutorial and other books. If they learn Py3 first, then immediately they have to learn Py2 because there's simply too much code out there that uses it. This will frustrate beginners as the next thing they need to do after my book is start using Python to make things. When the situation changes, and not just because the Python leaders say it does, then I'll update the book. Honestly though, I think Go, Rust, Nim, and Clojure have a better chance at widespread adoption than Python3 at this point. Incidentally, the mistake that the Python3 project made was to not use a virtual machine that could run both 2 and 3 byte code. If I can run tons of languages on my CPU, the JVM, and the .NET CLR, then Python3 could have run both 2 and 3. I predict that to get people on the new version of Python they will have to make Python4 and have it run 2,3 and 4 seamlessly so that it won't matter how much code is out there in any version of the language. Just my .02 on that topic.