[Tutor] redirecting help -- is this a bad idea?

Alan Gauld alan.gauld at blueyonder.co.uk
Sun Aug 1 10:48:27 CEST 2004

> pyhelp = help
> assigns pyhelp to that standard help function, and that assignment
> persists even after I have done my thing to make help call my custom

Yes because the old help is a name bound to a help function *object*
The assignment simply binds another new name to that same function

> pyhelp at the prompt will give the old instructions of help?

No problem because pyhelp is still pointing at the original help
object, not your new one.

> work as expected, once I've redirected help.

You redirect the name help but that doesn't change the underlying
original help object. Try some ASCII art:


pyHelp  ------->  [ original help function ]
help  ---------------


pyHelp  ------->  [ original help function ]

help  --------->  [ New help class ]

Does that help?

> Have I misunderstood your point?

You just got confused about how Python handles names
and function objects.

Alan g.

More information about the Tutor mailing list