15 ms·
90% of Python in 90 Minutes (2013)
- rubatuga 10y agoAlthough this ignores most of the differences between Python 2 vs 3, note that there will be differences in iterables, classes, and print functions. Feel free to comment if you aware of any more.
- yeukhon 10y agoI'd add unicode to this. Now the only string type is unicode in Python 3. I think [1] and [2] are good places, not sure if there's an absolutely easy-to-navigate summary from 2-3. [1]: https://docs.python.org/3/howto/pyporting.html https://docs.python.org/3/howto/pyporting.html [2]: http://python-future.org/compatible_idioms.html http://python-future.org/compatible_idioms.html
- kevin_thibedeau 10y agoBytes/Unicode strings is the biggie for anyone doing I/O.
- tempay 10y agoGenerally projects that suffer from the str/bytes/unicode mess is the hardest to port in my experience as 2to3 can't really help. Also relative/absolute imports can cause some confusing bugs.
- xapata 10y agoThat's because the programmer needs to make the choice of whether the data is text or just bytes. I suppose you could write a tool to infer that choice, but it wouldn't be perfectly accurate.
- tyingq 10y agoAnd see if that choice lines up with the v3 compatible version of any libraries they are using. Ones that touch the data anyway.
- danbruc 10y agoYou could easily reduce that ten fold, most of the slides contain little information. Every developer already knows that you can add integers, combine booleans with and, and have alternatives with if and else. Or how lists and maps work. No need to repeat this in such detail, just list the type names, keywords and operators. Instead focus on what is special about Python like indentation and colons, slicing, __iter__, arbitrary precision integers, ... This are the important things, otherwise you can not really say you know much about Python because it is generic stuff that applies to most languages under the sun.
- jacquesm 10y agoYou can just skip the slides you already know. Everybody has a different level of proficiency as a developer and a guide like this is aimed at a beginner, not at a seasoned developer. Since you don't know their background it doesn't hurt to repeat already familiar stuff because it is easy to move past that quickly if you already know it, but it would be a lot harder to make sense of the package if you so much as miss one or two simple steps or elements. For me one of the take-aways was the negative stride in a slice, I had not seen that yet and a couple of clever tricks such as 'dir' and 'help'. I've been doing nothing but python lately, and going through the whole deck to stop at the things I didn't know yet took only a couple of minutes.
- mlindner 10y agoI disagree. As a new coder when looking at a new language you don't know what's the same as what you're used to and what's different. Some things may be almost exactly the same but be slightly different. For example Python's division converts ints to floats in Python 3, for example. If you just leave out everything that's the same, the reader won't know what it's the same as. Also, the same compared to what? C? Everyone's first language is not the same.
- jacquesm 10y agoSuper useful, would be nice as anki deck.
- wyldfire 10y agoFrom slide 32: > (In Python 3 // is integer division) I find it clearer to describe this behavior as "floor" division. You might think "integer division" would have the same results as python 3's `int(a / b)` when `a` and `b` are ints, but, no, this is not the case. I never could quite understand why all the hub-bub about "integer division" and why it should change from python 2 to python 3 because the behavior seemed natural and similar to the native integer division on most processors. Indeed its behavior is astonishingly different with negative numbers. $ python2 -c 'print 2/3, -2/3, int(-2./3.)' 0 -1 0 $ python3 -c 'print(2//3, -2//3, int(-2.//3.))' 0 -1 -1 $ python3 -c 'print(2/3, -2/3, int(-2./3.))' 0.6666666666666666 -0.6666666666666666 0
- danbruc 10y agoIt is also worth noting that in most languages -2 / 3 yields 0 and not -1, i.e. integer devision rounds towards zero, not towards negative infinity.
- wyldfire 10y agoYes, in fact that's the point I'm trying to focus on but never made explicit. Thanks.
- tzs 10y agoInteger division rounding toward negative infinity makes it so that for integers a, b, with b > 0, then if a%b is defined as a - b * (a/b), you will always have 0 <= a%b < b. Integer division rounding toward zero makes that not so. a%b for negative a, positive b, will be <= 0. On the other hand, rounding toward negative infinity means that (-a)/b != -(a/b), when b does not divide a. Rounding toward zero makes (-a)/b = -(a/b). I think most mathematicians would rather have 0 <= a%b < b than (-a)/b = -(a/b) if they can't have both.
- danbruc 10y agoEric Lippert, a former C# compiler developer, has a good blog post [1] discussing the reasoning and the difference between modulus and remainder. [1] https://blogs.msdn.microsoft.com/ericlippert/2011/12/05/whats-the-difference-remainder-vs-modulus/ https://blogs.msdn.microsoft.com/ericlippert/2011/12/05/what...
- pbreit 10y agoI send people here for a summary: http://web2py.com/books/default/chapter/29/02/the-python-language http://web2py.com/books/default/chapter/29/02/the-python-lan... Then in a few more minutes can learn a framwework and be programming: http://web2py.com/books/default/chapter/29/01/introduction http://web2py.com/books/default/chapter/29/01/introduction
- jerryszczerry 10y agoI guess if learning 90% of something takes 90 minutes, the remaining 10% will take 10 years.
- scalesolved 10y agoAnd that is where problems start with keen and eager junior developers who think by knowing the 90% they really know the 100%.
- EToS 10y agoAbsolutely. Not using mutable variables as default arguments = 91%
- milesrout 10y agoPython doesn't have 'mutable variables'. I think you mean 'not binding mutable values as default arguments', but that's totally fine. What's wrong is not understanding when default arguments are bound. There's nothing inherently wrong with this: class Wrapper: def __init__(self, wrapped): self.wrapped = wrapped def counter(): def inner(w=Wrapper()): w.wrapped += 1 return w return inner
- sotojuan 10y agoUnfortunately here in HN we constantly upvote those junior developer's Medium posts.
- jacquesm 10y agoBlinking LED now in Node.js.
- deleted 10y ago[deleted]
- hamandcheese 10y agoSimilar to the 90-90 rule: https://en.wikipedia.org/wiki/Ninety-ninety_rule https://en.wikipedia.org/wiki/Ninety-ninety_rule
- Dowwie 10y agoLearning Python is easy but learning how to use Python well isn't. However, learning to use Python well pays great dividends and so the experience is worthwhile.
- mharrison 10y agoHence, when I'm doing a corporate training, this material takes about three days to cover.
- farhannyc 10y agoWhy are these books always focused on a fast learning principle? I really don't think anything useful can be made from 90 minutes of quick reading. It's a great refresher for people that didn't work with the language for a while. Now I remember python's annoying indents.
- hamandcheese 10y agoIts potentially valuable for anyone who needs to do some quick work in Python. There are quite a lot of little Python scripts I work with, even though I mostly do Ruby. I don't need (nor do I want to) become a Pythonista just to make some edits now and again.
- LrnByTeach 10y ago> Why are these books always focused on a fast learning principle? I really don't think anything useful can be made from 90 minutes of quick reading. So TRUE !!!!
- asmosoinio 10y ago> l.extend(12) ...For a list "l": that is wrong, "extend" expects an iterable, not an int.
- jwilk 10y agoIt's l2 (another list), not 12.
- jachee 10y agoA clear case where the "Readability counts." principle from "The Zen of Python" applies.
- asmosoinio 10y agoAh, true, my bad. Double confusing since the comment text, especially with the font, hints more at the "add twelve" case: > "Add l2 items to list" If it was worded for example "Add items of l2 to l", I think I would not have misinterpreted it. https://www.slideshare.net/MattHarrison4/learn-90/61?src=clipshare https://www.slideshare.net/MattHarrison4/learn-90/61?src=cli...
- lucasmullens 10y agoThis seems like a less-polished version of 'Learn X in Y Minutes'. Dropping phrases like "REPL" and "PEP" and only defining what they stand for doesn't really explain what they are. And the explanation of dunder methods at first seemed to suggest there are only 2. And calling this 90% of Python is really misleading. It's not even 90% of the syntax, let alone the whole language.
- Walkman 10y agoThat's nowhere near 90% of Python. It's strange because everyone thinks Python is an easy language to learn, but that's not True at all. It's easy to pick up and be productive with it in a very short time, yes, but the interpreter has so much going on you can't learn everything in years. If you happen to learn everything about protocols, the interpreter gotchas, there is the standard library which is also huge, and if you got everything in it, there is the ecosystem, which is so large nobody can know about every package. And I did not talked about the whole new world of Python3, asyncio and the whole old world of Twisted.
- jacquesm 10y ago> If you happen to learn everything about protocols, the interpreter gotchas, there is the standard library which is also huge, and if you got everything in it, there is the ecosystem, which is so large nobody can know about every package. I don't think the library and packages are part of the language though. Just like there is a 'C' without a standard library there is Python 'the language'. As for the 90%, 90% of the code you write is boring and simple. The one thing I really missed in the slides was list comprehensions, presumably they are in the '10%', but I use them all the time.
- mharrison 10y agoYeah, these slides were for a long conference talk that introduced the basic syntax of Python to developers who weren't familiar with Python. (List) comprehensions are super cool, as are generators, decorators, etc, but there just wasn't enough time to cover that. Plus, as you say most code is boring, and you can get by with the material in this deck.
- Terr_ 10y ago> That's nowhere near 90% of Python. [...] the interpreter has so much going on you can't learn everything in years. [...] the ecosystem, which is so large nobody can know about every package. I'm pretty sure that this "90% of Python" is in the context of the stuff an already-experienced developer needs to absorb to honestly put "Python" under "Languages" in a resume... ... Not the amount of knowledge you need to say "I know everything there is to know about Python, it's implementation details, and its entire associated ecosystem of third-party applications." > but that's not True at all Can't tell if intentional, or habit :P
- mozumder 10y agoAbout slide 51: "No Multi-line comments" You can use triple-quote strings as multi-line comments: https://twitter.com/gvanrossum/status/112670605505077248 https://twitter.com/gvanrossum/status/112670605505077248
- Xcelerate 10y agoThis is a nice little presentation! Although I wish there was a "context switching" guide that highlights the main differences between all of the languages. After working in Julia or Python for 8 hours, I switch to JavaScript and suddenly forget how strings work. I wish there was a giant table with all of the main differences between the major languages listed so I can glance at it quickly and be on my way.
- jacquesm 10y agoThat's my main reason for thinking really long and hard about what eco-systems to invest in. I've settled on Python and Erlang for now and I really hope that that bet will pay off. Everything else except for Java seems transient to me.
- mharrison 10y agoJust noticed this on my commute home (author of slides). This is an old and condensed version of corporate training that I run. Typically the training runs for some 4 days. If you want a more modern version of this material (that you can submit your PR's to), check out my Python 3.6 reference[0]. If you have any questions, fire away, and I'll do my best to answer them. [0]- https://github.com/mattharrison/Tiny-Python-3.6-Notebook https://github.com/mattharrison/Tiny-Python-3.6-Notebook
- 77ko 10y agothanks, its a nice quick ref. bought.
- sgslo 10y agoAs one content creator to another: thank you for the material, especially at a reasonable price of $10. Purchased.
- mharrison 10y agoI appreciate that. Thanks!
- voltagex_ 10y agoIs there any other way to support you? I don't really need any more physical books.
- icebraining 10y agoWhy not purchase it and give it away?
- raybb 10y agoSpecifically, you could give it away to a local library :)
- mharrison 10y agoAs a self published author, the best way to support me is to review on Amazon or share on social media :)
- Fake4d 10y agoI really love the learnxinyminutes project. If anyone doesnt know it here is the Link: https://learnxinyminutes.com/ https://learnxinyminutes.com/ It is kind of the same approach to the beginning of a new language. Here is the direct link for the python3 source: https://learnxinyminutes.com/docs/python3/ https://learnxinyminutes.com/docs/python3/