|
Subject:
|
Displaying _doc_
|
|
Posted By:
|
Ave
|
Post Date:
|
8/19/2007 10:10:19 PM
|
I'm confused over the _doc_ method on page 63, Chapter 5. It says here to:
"..exit the interactive session that you entered in the last example and re-invoke ch5.py, since it now has the docstring added to in_fridge. After you do that, you can do the following:
>>>print "%s" % in_fridge._doc_ This is a function to see if the fridge has a food. fridge has to be a dictionary defined outside of the function. the food to be searched for is in the string wanted_food. "
WHAT??????
When I do this, nothing happens but a syntax error.
God, you people write books? I hope the authors are fired from their writing jobs, they obviously don't know how to explain programming languages well at all.
For the record, I work on an application development team but use .NET with Visual Studio. I've heard great things about Python but so far the code editor really sucks. The explanations in this book surely do not help.
Tip to the authors: If you are going to waste time writing a book for beginners and then charge them almost $50 to buy it, then you OWE it to them to correctly explain how the editor works so they do not get hung up on it.
This book really sucks, I want my money back.
|
|
Reply By:
|
jp_princess
|
Reply Date:
|
6/3/2008 1:11:01 PM
|
Hey although this user probably already got an answer to his/her issue with the syntax error associated with ._doc_, I had to continue searching and so will post the answer here for those who come upon this page with the same problem:
use TWO underscores, not ONE--> ._doc_ won't work, instead use .__doc__
|
|