I like to call “Professor Internet” is the third form of help. When you search the Internet, make sure you include Python as one of your search terms, followed by the thing you’re wondering about. If you know that it’s part of or related to something else, then include that other thing as a search term as well. For example, don’t search for print, because that’s too broad. Search instead for python print. (Capitalization won’t matter.) Another example is if you were interested in the Button widget of the Tkinter toolset (which you meet at dummies.com/go/pythonforkids) you’d search for python button tkinter.
You use a different search strategy online from what you need for the interactive help.
If ads are in your results, skip them.
Source code
Source code is the final form of help. Keep in mind that Python is an interpreted language. This means that what you read is what the computer executes. As a result, if you want to know how some third-party module does something (the Python core isn’t written in Python, so that won’t help), you can literally look at it and see exactly how it did it. You won’t understand it at first, but no matter. Dive in. It starts making sense after a while.
Check out the Python community that’s out there. Look for Internet forums related to Python. The Stackoverflow website (http://stackoverflow.com/questions/tagged/python) is helpful when I’m figuring out problems.
Often, an Internet search will turn up questions that someone else has already asked. If you know the answer to a question, answer it. If you’re correct, and thorough, you’ll get a good reputation.
Don’t guess at an answer. Only post if you’re sure. Also, don’t give your personal information to anyone online. Stick to the topic of programming.
PEPs
Python changes, or evolves, when you use proposal documents called Python Enhancement Proposals (known as PEPs). Each PEP proposes some change to Python; the change is either used or ignored. They may provide you some history about how one feature or another was added to Python.
You can ignore most PEPs, but do check out the following two when you’re ready to move on from the projects in this book:
✓ PEP 8, Style Guide for Python Code has rules about how to format your Python code. For example, it suggests the amount of indent for code blocks (see Project 2). It also has rules (called conventions) for naming. I did my best to follow PEP 8 rules in this book, but sometimes the lines are longer than they recommend.
✓ PEP 257, Docstring Conventions sets different conventions relating to docstrings. Docstrings explain, in normal language, what a program (or part of one) is doing. You meet docstrings in Project 5.
You don’t have to follow (comply with) with PEPs, but try to. It makes it easier for other people to read your code. Heck, it makes it easier for you to read your code. My earlier Python code isn’t PEP 8 compliant, and going back to it is a real pain. Simple things like capital letters in a name make a difference.
Planet Python and PyCon
Конец ознакомительного фрагмента.
Текст предоставлен ООО «ЛитРес».
Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.
Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.