I just want to say that I am very disappointed with Guido van Rossum's latest tutorial.
I like to follow along typing in the examples and seeing how they run. I seem to catch on to things better that way.
But this tutorial's examples haven't been throughly checked because some of them are just not good.
Yes, things are free, and yes I like Python and yes, thanks to Guido for allowing the world to use his work without charge.
I will give a couple of examples:
Section 4.4 looking for prime numbers.
Section 4.7.1 default arguments.
I stopped at this point and went looking for another tutorial.
Hey, it's hard enough for a cracker-brain like me to learn this stuff without having faulty guides.
Good lord, do I ever feel better.
Thanks

Iacobus2

I have to agree with you, good sample code would be nice. I do dislike anything more than "one liners" written on the interactive page, it's just too confusing. Tutorials are used mostly by beginners, looks like Guido has forgotten what it is to be a beginner!

Look at it this way, the silver lining, it gives folks like me a chance to send out an improved, in my opinion at least, code snippet ...

# multi answer

def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
    while True:
        ok = raw_input(prompt)
        if ok in ('y', 'ye', 'yes', 'Yes', 'Y', 'si', 'ja'): return True
        if ok in ('n', 'no', 'nop', 'nope', 'No', 'N', 'nein'): return False
        retries = retries - 1
        if retries < 0: raise IOError, 'slow learner?'
        print complaint
        
if ask_ok('Do you really want to quit? '):
    print "I quit"
else:
    print "I won't quit"

Actually, I think the whole Python help file should contain lots of sample code, other languages like BCX or Ruby have plenty examples!

Atta' way to go, Vegaseat!
This is another example showing there is some good in every bad?

By the by, I deleted my e-mail settings at Yahoo. Well as soon as I did that, I lost the password to this site. Originally I was logging on as Iacobus. So I had to register again, hence the username, iacobus2. How canI be so dumb? Hey, it's easy!
:lol: :lol: :lol: :lol:

why when running this code do i get this error

shane@mainbox shane $ python test
  File "test", line 9
    retries = retries - 1
    ^
SyntaxError: invalid syntax

does this not run in python-2.3?

edit added later//

the problem was my indenting got screwed up when I copied and pasted it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.