开发者

What should people new to Python know about its community and ecosystem? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

I'm cobbling together some sort of an introduction to Python, but one that focuses on the community and the ecosystem around Python rather than just the language. With How to Think Like a Computer Scientist and other great tutorials, it's easy to get familiar with the language, but it took me a fair while before I knew what The Cheese Shop, or, err, PyPi is about, how pip and virtualenv work and why you should use them, where you should go for help, the interesting blogs that you should follow, how your code should look (PEP 8, writing pythonic code) and so on. The 'soft stuff'.

What confused you the most when you just started out with Python? Are there certain things that you would've wanted to know about, or resources you wish you would have stumbled upon earlier than y开发者_StackOverflow中文版ou did? People to know about?

I found a few similar questions on StackOverflow (e.g. here) but nothing really close to what I'd like to hear from you guys. Hope this question doesn't feel too subjective to your tastes :-)

(And, if you'd like to help out, feel free to send a message.)


I think one of the most important thing a beginner need to know about Python ecosystem is that it's a general purpose language surrounded by specialized libs. Experienced pythonistas know them, but a newbie can't:

  • Don't stop to tkinter : go wx, gtk or qt.
  • Don't dev web code by hands : use TurboGears, Pylons, Web.py or Django.
  • Don't parse HTML / XML with hard tools : use lxml or beautifulsoup.
  • Don't make syscall to imagemagik : use PIL.
  • Don't make advanced maths manually : use NumPy and SciPy.
  • Don't access simple databases by hand : use ORM like SQLAlchemy.
  • Don't reinvent sysadmin wheels : use Fabric.
  • etc.

The main ones should be listed in a book with guidances to choose among them.


"What confused you the most when you just started out with Python?"

Rule 2 of learning Python: Any general-purpose module or framework you think you want has already been written. Several times.

The hard part is realizing that your idea is

  1. Not unique.

  2. Been already improved upon before you even starting thinking about it.

  3. Already posted somewhere.

So, code less and search more. Search widely and flexibly until you find things that are similar to what you want to do.

  • Realize that you might have a name you think is descriptive. But other folks may call it something different. Join the community, adopt their naming. You may not like the phrase "ORM", but that's what it's called.

  • Realize that your idea, no matter how sound it seems, may be really poor. When you find a framework that seems to have "needless extra features", you may be missing something from your idea.

  • Realize that your idea, no matter how "intuitive" it seems, may be really poor. When you find a framework that seems "counter-intuitive", the problem could be yours. Learn theirs first, then compare and contrast after you've mastered theirs. Until you've mastered theirs, keep searching and learning.


A few points related to the ecosystem and indirectly the community:

  • I wished I had been reminded more about the Batteries included. I think people should be told to print-out the Table of Contents of the Standard Library and keep it under their pillow, for frequent reviews (that advice, I finally took, several years into it, from an online intro/beginner's video presentation!). The [relative] stability, extensive but relevant content of the Std Lib speaks to the thoughtful governance of the community leaders and its beloved BDFL.

  • I think newcomers can also be "warned" (the word is maybe too strong, too unfair) about the extreme variety of PiPy. This reflects the vibrant, smart and diverse (in terms of background, domain of application, interests...) collective of users and contributors. This however can be overwhelming and possibly risky as all packages in there are not "prime time ready" (But many are and "saved my life" many times over).

  • Even if you feel too new to Python, don't only use the libraries, do peek under the hood! This is true of many languages, but maybe particularly of Python, there's much to be learned from perusing various source code. The reasons this may be particular true for Python are intrinsic to the language itself (multi-paradigms, hi level of abstraction...) but also because of the relative uniformity of coding (and architecting) style and because of the general level of collaboration within the community.


"What confused you the most when you just started out with Python?"

Rule 1 of learning Python: Use the Source, Luke.

There are question on SO asking for "good" source from which to learn Python. The best answers amount to "read the libraries that came with Python."

One can say that the libraries that come with Python are quirky. In places. Which makes them all the better for learning from.

  1. There's a community of like-minded people who are not clones.

  2. Open source software is the highest-quality software you'll ever get to work with, but it's not created by paid developers who will rigidly enforce standards.


explaining what a PEP is, how it is written and who wrote them, where we can find them. PEPs give a lot of background informations about a specific feature of the language. they also are the tool which shows how fast evolving python is.

(i wish i had read some PEPs earlier, but i was not really aware of them, although they are frequently linked in the manual)


From PEP 20:

import this

(aka, the Zen of Python)


developing a python package that can be installed with easy_install etc... I consider it equivalent to developing a jar or dll etc....

on the same token, developing said package(s) with virtualenv or buildout

If I would have known those things sooner, I would have probably used python for more than just scripting way back when I first started using it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜