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() is useful in at
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 getattr(os.path,isdir).__doc__
Test whether a path is a directory
Thanks!
--
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 useful when the
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
Steven D'Aprano wrote:
On Tue, 21 Nov 2006 22:39:09 +0100, Mathias Panzenboeck wrote:
Yes, this is known. I think IronPython uses a specialized dictionary for
members, which prohibits
malformed names. I don't know if there will be such a dictionary in any
future CPython version.
On Tue, 21 Nov 2006 22:39:09 +0100, Mathias Panzenboeck wrote:
[EMAIL PROTECTED] wrote:
There is an interesting skewness in python:
class A(object): pass
a=A()
setattr(a, '$foo', 17)
getattr(a, '$foo')
17
But I can't write
a.'$foo'
Yes, this is known. I think IronPython uses