how to go on learning python
I'm basically a c/c++ programmer and recently come to python for some web development. Using django and javascript I'm afraid I can develop some web application now. But often I feel I'm not good at python. I don't know much about generators, descriptors and decorators(although I can use some of it to accomplish something, but I don't think I'm capable of knowing its internals). I find my code ugly, and it seems near everything are already gotten done by the libraries. When I want to do something, I just find some libraries or modules and then just finish the work. So I'm a bit tired of just doing this kind of high level scripting, only to find myself a bad programmer. Then my question is after one coded some kind of basic app, how one can keep on learning programming using python? Do some more interesting projects? Read more general books about programming? or...? -- http://mail.python.org/mailman/listinfo/python-list
Re: how to go on learning python
Howdy Xavier! [Apologies for the length of this; I didn't expect to write so much!] I've been a Python programmer for many years now (having come from a PHP, Perl, C, and Pascal background) and I'm constantly learning new idioms and ways of doing things that are more Pythonic; cleaner, more efficient, or simply more beautiful. I learn by coding, rather than by reading books, taking lectures, or sitting idly watching screencasts. I constantly try to break the problems I come up with in my head into smaller and smaller pieces, then write the software for those pieces in as elegant a method as possible. Because of my turtles all the way down design philosophy, a lot of my spare time projects have no immediate demonstrable benefit; I code them for fun! I have a folder full of hundreds of these little projects, the vast majority of which never see a public release. I also collect little snippets of code that I come across[1] or write, and often experiment with performance tests[2] of small Python snippets. Often I'll assign myself the task of doing something far outside my comfort zone; a recent example is writing a HTTP/1.1 web server. I had no idea how to do low-level socket programming in Python, let alone how HTTP actually worked under-the-hood, and because my goal wasn't (originally) to produce a production-quality product for others it gave me the freedom to experiment, rewrite, and break things in as many ways as I wanted. :) I had people trying to convince me that I shouldn't re-invent the wheel (just use Twisted!) though they mis-understood the reason for my re-invention: to learn. It started as a toy 20-line script to dump a static HTTP/1.0 response on each request and has grown into a ~270 line fully HTTP/1.1 compliant, ultra-performant multi-process HTTP server rivalling pretty much every other pure-Python web server I've tested. (I still don't consider it production ready, though.) Progressive enhancement as I came up with and implemented ideas meant that sometimes I had to rewrite it from scratch, but I'm quite proud of the result and have learned far more than I expected in the process. While I don't necessarily study books on Python, I did reference HTTP: The Definitive Guide and many websites in developing that server, and I often use the Python Quick Reference[3] when I zone out and forget something basic or need to find something more advanced. In terms of understanding how Python works, or how you can use certain semantics (or even better, why you'd want to!) Python Enhancement Proposals (PEPs) can be an invaluable resource. For example, PEP 318[4] defines what a decorator is, why they're useful, how they work, and how you can write your own. Pretty much everything built into Python after Python 2.0 was first described, reasoned, and discussed in a PEP. If you haven't seen this already, the Zen of Python[5] (a PEP) has many great guidelines. I try to live and breathe the Zen. So that's my story: how I learn to improve my own code. My motto, re-inventing the wheel, every time, is the short version of the above. Of course, for commercial work I don't generally spend so much time on the nitty-gritty details; existing libraries are there for a reason, and, most of the time, Getting Things Done™ is more important than linguistic purity! ;) — Alice. [1] https://github.com/GothAlice/Random/ [2] https://gist.github.com/405354 [3] http://rgruet.free.fr/PQR26/PQR2.6.html [4] http://www.python.org/dev/peps/pep-0318/ [5] http://www.python.org/dev/peps/pep-0020/ -- http://mail.python.org/mailman/listinfo/python-list
Re: how to go on learning python
On 11/30/2010 9:37 AM, Xavier Heruacles wrote: I'm basically a c/c++ programmer and recently come to python for some web development. Using django and javascript I'm afraid I can develop some web application now. But often I feel I'm not good at python. I don't know much about generators, descriptors and decorators(although I can use some of it to accomplish something, but I don't think I'm capable of knowing its internals). I find my code ugly, and it seems near everything are already gotten done by the libraries. When I want to do something, I just find some libraries or modules and then just finish the work. So I'm a bit tired of just doing this kind of high level scripting, only to find myself a bad programmer. Then my question is after one coded some kind of basic app, how one can keep on learning programming using python? Do some more interesting projects? Read more general books about programming? or...? You can use both your old C skills and new Python skills by helping to develop Python by working on issues on the tracker bugs.python.org. If you are interested but needed help getting started, ask. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Intro to Python slides, was Re: how to go on learning python
On Tue, Nov 30, 2010 at 6:37 AM, Xavier Heruacles xheruac...@gmail.com wrote: I'm basically a c/c++ programmer and recently come to python for some web development. Using django and javascript I'm afraid I can develop some web application now. But often I feel I'm not good at python. I don't know much about generators, descriptors and decorators(although I can use some of it to accomplish something, but I don't think I'm capable of knowing its internals). I find my code ugly, and it seems near everything are already gotten done by the libraries. When I want to do something, I just find some libraries or modules and then just finish the work. So I'm a bit tired of just doing this kind of high level scripting, only to find myself a bad programmer. Then my question is after one coded some kind of basic app, how one can keep on learning programming using python? Do some more interesting projects? Read more general books about programming? or...? -- http://mail.python.org/mailman/listinfo/python-list You could check out these slides from an Intro to Python talk I'm giving tonight: http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/ ...perhaps especially the Further Resources section at the end. The Koans might be very nice for you, as might Dive Into Python. BTW, if you're interested in Python and looking into Javascript anew, you might look at Pyjamas. It lets you write web apps in Python that also run on a desktop; you can even call into Raphael from it. Only thing about it is it's kind of a young project compared to most Python implementations. PS: I mostly came from C too - knowing C can be a real advantage for a Python programmer sometimes. -- http://mail.python.org/mailman/listinfo/python-list