OpenTechSchool / python-beginners

Workshop material for "Introduction to Programming with Python"
http://opentechschool.github.io/python-beginners/
175 stars 253 forks source link

Quotes around help #36

Closed richardeigenmann closed 11 years ago

richardeigenmann commented 11 years ago

Adding quotes around the help(turtle.color) as this fails if turtle hasn't been imported

Ivoz commented 11 years ago

Practically all of the tutorial will fail if the turtle module hasn't been imported, though, which you are asked to do at the start of that page. I feel this would add inconsistency to the process.

richardeigenmann commented 11 years ago

I got caught out because I wanted to check out the API of turtle and the help command sounded like exactly what I want so I opened a new session, started Python and typed my help instruction. Eventually it worked when I added quotes. Perhaps we could add a sentence such as "(be sure to import turtle before calling help as help uses to imported context to find the correct information)" ?

What was "unusual" to me as a newbie is that help depends on the import. Man pages don't work that way and Javadoc pages don't either. Though it makes perfect sense that Python help needs to have the imports so that it it shows the proper page when there might be multiple versions of a library available on the system.

Regards, Richard

On Sun, 2013-06-16 at 00:31 -0700, Matt Iversen wrote:

Practically all of the tutorial will fail if the turtle module hasn't been imported, though, which you are asked to do at the start of that page. I feel this would add inconsistency to the process.

— Reply to this email directly or view it on GitHub.

projectgus commented 11 years ago

This is definitely a common pitfall for new students.

I've pushed a commit with my preferred solution, which is showing a Tip with the NameError and explaining it (the point where you experienced it is the most common point I think, because it's the first time the student re-opens a previously closed interactive prompt after running non-interactive programs for a while.) As both @Ivoz and Richard point out, Python needs imports for many things so I think it's worthwhile taking the time out to explain that, giving people the right idea about how to approach it.

What do you think, @richardeigenmann?

richardeigenmann commented 11 years ago

This seems perfectly reasonable.

Thanks, Richard

On Sat, 2013-06-22 at 01:59 -0700, Angus Gratton wrote:

This is definitely a common pitfall for new students.

I've pushed a commit with my preferred solution, which is showing a Tip with the NameError and explaining it (the point where you experienced it is the most common point I think, because it's the first time the student re-opens a previously closed interactive prompt after running non-interactive programs for a while.) As both @Ivoz and Richard point out, Python needs imports for many things so I think it's worthwhile taking the time out to explain that, giving people the right idea about how to approach it.

What do you think, @richardeigenmann?

— Reply to this email directly or view it on GitHub.

projectgus commented 11 years ago

Awesome, thanks. :)