D
David Goodger
python.net/~goodger · Personal blog · on HN since 2007
David Goodger hosts his PyCon 2007 handout "Code Like a Pythonista: Idiomatic Python" and related Python material.
What HN saysHN commenters call terse resources like his idiomatic Python handout the best learning material, a goldmine and a good complement to Python tutorials.
22HN people shared it
15linked it in comments
8stories submitted
259story points
9 years agolast shared
2007people per year2026
Most-shared posts
- 1Code Like a Pythonista: Idiomatic Python19 people · 257 points · first shared 2007 · 56 comments on HN
- 2Code Like a Pythonista: Idiomatic Python1 people · 2 points · first shared 2008 · discussion on HN
- 3Idiomatic1 people · first shared 2012
- 4Homepage1 people · first shared 2008
What HN people wrote when they linked it
aDemoUzer · 2012-03-04
Try python - it would blow your mind.
For 7 years, I too was a PHP believer for its simplicity. It was my favorite language by far.
1.2 year ago, I started to use python and was hesitant with it at first. As I worked more and more in python, I simply fell in love it. It does lot of greats things that PHP does (dynamic arrays, dictionaries, and functional programming) and adds lot more functionality that PHP is missing.
1. How would you add a new element to an array?
PHP: array[] = 2
Python: array += [2]
2. How to combine 2 arrays?
PHP: ?? array_merge(...) ??
Python: array += array <- it is as simple as appending to a string.
Lot more fun examples: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#…
BasDirks · 2012-02-25
I find that terse resources like this (and for example Code Like a Pythonista: Idiomatic Python[1]) are the best learning resources. A true goldmine.
[1]: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
madars · 2009-07-27
> its still my contention that the best method by which to learn any language is the "There ain't nothin' to it but to do it" method.
This is really good method, but doing it alone may not teach you the correct paradigms of the language. You can write FORTRAN in any language, but you probably shouldn't.
If I were about to learn Python by just converting some PHP fragments, I would surely miss those characteristics that seperate Python from PHP. However, by reading other people's code or reading some documents on idiomatic Python (e.g. [1]), my understanding would be much better.
[1] - http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
lbolognini · 2008-11-27
Idiomatic Python: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
Probably the best complement to the aforementioned tutorials. Dive into Python is good but i hate the examples he makes.
d0mine · 2011-11-28
A formidable effort.
It might be matter of taste but recommendations given starting from "Understanding the packages" and to "Install packages that need compiling" are almost harmful.
My preference:
* you should not care what is your `sys.path` looks like. You need it for debugging if something goes horribly wrong. A tutorial might mention it but things like `sys.path.insert(0,..)` should be avoided or accompanied with a big disclaimer (don't use nuclear weapons if you care about the future)
* the same goes for `PYTHONPATH`. It is a hack that rarely
needed
* don't use `sudo pip`. System packages should be managed by a system packager. Use `pip --user` or create a `virtualenv`
* `pip` can handle tarballs there is no need for `python setup.py install` in this case.
"Code Like a Pythonista: Idiomatic Python" is worth mentioning
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
Some third-party packages that could be listed (it is subjective):
bpython - interactive prompt; something for tests e.g., pytest, tox, selenium; sphinx - docs; lxml - xml/html, werkzeug - if you talking about web-development; SQLAlchemy - sql; Cython - C extension, ~ Python syntax; async. libs e.g., gevent, Twisted.
vram22 · 2017-10-28
It is probably somewhat out of date now (w.r.t. to new language and library features of Python), but David Goodger's site also has a list of idiomatic Python topics; had read it a while ago. This is it:
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
wyldfire · 2016-06-21
Mr Kennedy -- this is an interesting course synopsis, it looks like you've put a lot of good work into it. The course itself is not public access, but the materials are.
> The few features that are Python 3 specific will be highlighted as such (e.g. new dictionary merging syntax).
The print statement=>function is a pretty big one too. IMO it's not too much of a wart to import it from the future in order to straddle 2.x/3.x.
Anyone else who came hoping to read actual content on how to write more Pythonic code should consult this popular reference from Pycon '07 [1].
[1] http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
devnonymous · 2016-05-28
* write unit tests (I find nosetests or pytest as the test runners most useful and mock incredibly helpful).
* run unit tests and integration tests in an automated manner for every commit. (a.k.a use tox, jenkins or somesuch...).
* Depending on the software you are creating deploy a chaos monkey[1] kinda approach for disaster/HA testing.
* Read up on good Python practices :
http://python-guide.readthedocs.io/en/latest/
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
potatosareok · 2015-08-18
Another useful brief overview - http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
theworst · 2014-10-20
Not familiar with Modern Perl, and I guess you could call 2007 not modern... but check out http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
ak217 · 2012-09-14
Idiomatic Go: http://golang.org/doc/effective_go.html
Idiomatic Python: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html (doesn't cover a number of important things)
When comparing the two, I'm not impressed with Go.
mekarpeles · 2012-07-03
In case other Python enthusiasts are seeking additional resources (besides reading PEP 8) Bhadra and others on stack overflow suggest:
Code Like a Pythonista: Idiomatic Python (http://python.net/~goodger/projects/pycon/2007/idiomatic/)
Common mistakes and Warts (http://learnpython.pbwiki.com/PythonTricks)
How not to write Python code (http://eikke.com/how-not-to-write-python-code/)
Python gotcha (http://eikke.com/python-gotcha/)
Here's the stack overflow thread I was looking at:
http://stackoverflow.com/questions/356161/python-coding-standards-best…
DocSavage · 2009-08-04
The PLEAC codebase was new to me. It reminds me of the idiomatic python reference (http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html) I've found very useful, but haven't delved into PLEAC to see if the coding examples are truly idiomatic.
Python > http://pleac.sourceforge.net/pleac_python/index.html
Ruby > http://pleac.sourceforge.net/pleac_ruby/index.html
Coverage varies depending on the language.
bootload · 2008-06-03
Guido ~ http://www.artima.com/weblogs/index.jsp?blogger=guido
David Mertz ~ http://gnosis.cx/publish/tech_index_cp.html
Uche Ogbuji ~ http://www.xml.com/pub/au/84 & http://copia.ogbuji.net/blog/
Mark Pilgrim ~ http://diveintomark.org/
David Goodger ~ http://python.net/~goodger/
axitkhurana · 2011-10-02
For python vs ruby:
Why Python over ruby: http://news.ycombinator.com/item?id=682101
Django vs Ruby on Rails: http://news.ycombinator.com/item?id=195423
Python vs ruby in depth: http://news.ycombinator.com/item?id=741257
I use Python, Some resources for learning Python in no particular order:
The Official Python Tutorial - docs.python.org/tutorial/
"Dive Into Python", by Mark Pilgrim - http://diveintopython.org/toc/index.html
"A Byte of Python" - swaroopch.com/notes/Python
Google's Intro to Python Class (online) - http://code.google.com/edu/languages/google-python-class/
"The New Boston" Programming Python Tutorials - http://youtube.com/user/thenewboston#g/c/EA1FEF17E1E5C0DA
"Building Skills in Python", by Steven F. Lott - http://homepage.mac.com/s_lott/books/python/html/index.html
"Think Python: How to Think Like a Computer Scientist" - http://greenteapress.com/thinkpython/thinkpython.html
"Code Like a Pythonista: Idiomatic Python" - http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
OpenCourseWare: MIT 6.00 Introduction to Computer Science and Programming - http://ocw.mit.edu/courses/electrical-engineering-and-computer-science…
"Learn Python the Hard Way" by Zed Shaw - http://learnpythonthehardway.com
Practice Questions at PySchools - http://pyschools.com
Begin Python - http://beginpython.com
More Tutorials - http://awaretek.com/tutorials.html
source:…