With a view to exploring Numeric3, below is a script to check the availability of doc strings. Some are not yet available. There is a method __class__ module but the purpose is not clear. Colin W. # checkDocs.py ''' To check the availabilty of doc strings for the ndarray class. Among the attributes of ndarray is: __class__ module(name[, doc]) Create a module object. The name must be a string; the optional doc argument can have any type. ndarray is referenced as a class and reported as "<type 'type'>" but the common Python usage is <type 'classobj'> see the last output line. ''' import scipy.base.multiarray as M print type(M.ndarray) print '>', type( M) print 'module doc:', M.__doc__ for i in dir(M.ndarray): print i, try: print eval('M.'+i+'.__doc__') except: print 'No doc' print '\n', M.ndarray.__doc__ print type(M.ndarray) # Check normal usage import timeit print timeit.Timer, type(timeit.Timer)
Colin J. Williams wrote:
With a view to exploring Numeric3, below is a script to check the availability of doc strings.
Some are not yet available.
I don't think your script will pick up the docs for the ndarray methods. You need to replace eval('M.'+i+'.__doc__') with eval('M.ndarray.'+i+'.__doc__') -Travis
Colin J. Williams wrote:
With a view to exploring Numeric3, below is a script to check the availability of doc strings.
Some are not yet available.
There is a method __class__ module but the purpose is not clear.
Colin W.
# checkDocs.py ''' To check the availabilty of doc strings for the ndarray class.
Among the attributes of ndarray is: __class__ module(name[, doc])
I'm not sure what you are talking about here? Where are you getting this? I don't know of any such attribute. There is a __class__ attribute. But I don't see a __class__ module(name[, doc]) attribute -Travis
Travis Oliphant wrote:
Colin J. Williams wrote:
With a view to exploring Numeric3, below is a script to check the availability of doc strings.
Some are not yet available.
There is a method __class__ module but the purpose is not clear.
Colin W.
# checkDocs.py ''' To check the availabilty of doc strings for the ndarray class.
Among the attributes of ndarray is: __class__ module(name[, doc])
I'm not sure what you are talking about here? Where are you getting this?
I don't know of any such attribute. There is a __class__ attribute. But I don't see a
__class__ module(name[, doc]) attribute
-Travis
------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
It might have been clearer if I had referred to the name "__class__" in the multiarray module. Please see the sequence below: >>> import scipy.base.multiarray as M >>> M.__class__ <type 'module'> >>> I am surprised that this name points to a module. It usually is an attribute of a class instance which points to the class object of that instance. Colin W.
I'm not sure what you are talking about here? Where are you getting this?
I don't know of any such attribute. There is a __class__ attribute. But I don't see a
__class__ module(name[, doc]) attribute
-Travis
Please see the sequence below:
>>> import scipy.base.multiarray as M >>> M.__class__ <type 'module'> >>>
I am surprised that this name points to a module. It usually is an attribute of a class instance which points to the class object of that instance.
Why is this surprising? scipy.base.multiarray is a module, therefore it's "class" is type 'module'. This seems fine to me. At any rate, Python is assigning the __class__ attribute to the extension module multiarray, so it is what it is. -Travis
Colin J. Williams wrote:
>>> import scipy.base.multiarray as M >>> M.__class__ <type 'module'> >>>
I am surprised that this name points to a module.
<type 'module'> is NOT a module, it's the type (or class) to which all modules belong. This is to be expected if scipy.base.multiarray is itself a module. The reason it says <type 'module'> and not <class 'module'> is because it's a built-in type/class rather than one defined in Python. But ever since the type/class unification, there's very little difference in meaning between the terms 'type' and 'class'. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg.ewing@canterbury.ac.nz +--------------------------------------+
Travis Oliphant wrote:
I'm not sure what you are talking about here? Where are you getting this?
I don't know of any such attribute. There is a __class__ attribute. But I don't see a
__class__ module(name[, doc]) attribute
-Travis
Please see the sequence below:
>>> import scipy.base.multiarray as M >>> M.__class__ <type 'module'> >>>
I am surprised that this name points to a module. It usually is an attribute of a class instance which points to the class object of that instance.
Why is this surprising? scipy.base.multiarray is a module, therefore it's "class" is type 'module'. This seems fine to me. At any rate, Python is assigning the __class__ attribute to the extension module multiarray, so it is what it is.
-Travis
Yes, this is the Python practice:
import timeit timeit.__class__ <type 'module'> import anydbm anydbm.__class__ <type 'module'>
Yes, timeit.__class__ points to the internal module creator function:
import new new.module <type 'module'> new.module.__doc__ 'module(name[, doc])\n\nCreate a module object.\nThe name must be a string; the optional doc argumen t can have any type.' new.module is timeit.__class__ True
With a little digging, this is logical, consistent and no longer surprising. Colin W.
participants (3)
-
Colin J. Williams
-
Greg Ewing
-
Travis Oliphant