Re: About getattr()

2007-02-12 Thread Duncan Booth
Leif K-Brooks <[EMAIL PROTECTED]> wrote: >> Why do I still need the getattr() func as below? >> > print getattr(os.path,"isdir").__doc__ >> Test whether a path is a directory > > You don't. Correct > getattr() is only useful when the attribute name is > determined at runtime. > getattr()

Re: About getattr()

2007-02-11 Thread Samuel Karl Peterson
"Jm lists" <[EMAIL PROTECTED]> on Mon, 12 Feb 2007 12:36:10 +0800 didst step forth and proclaim thus: > Hello, > > Since I can write the statement like: > > >>> print os.path.isdir.__doc__ > Test whether a path is a directory > > Why do I still need the getattr() func as below? > > >>> print g

Re: About getattr()

2007-02-11 Thread Leif K-Brooks
Jm lists wrote: > Since I can write the statement like: > print os.path.isdir.__doc__ > Test whether a path is a directory > > Why do I still need the getattr() func as below? > print getattr(os.path,"isdir").__doc__ > Test whether a path is a directory You don't. getattr() is only us