|
From: Colin J. W. <cj...@sy...> - 2006-02-22 15:29:00
|
I've been trying to gain some understanding of dtype from the builtin documentation and would appreciate advice. I don't find anything in http://projects.scipy.org/scipy/numpy or http://wiki.python.org/moin/NumPy Chapter 2.1 of the book has a good overview, but little reference material. In the following, dt= numpy.dtype Some specific problems are flagged ** below. Colin W. [Dbg]>>> h(dt) Help on class dtype in module numpy: class dtype(__builtin__.object) | Methods defined here: | | __cmp__(...) | x.__cmp__(y) <==> cmp(x,y) | | __getitem__(...) | x.__getitem__(y) <==> x[y] | | __len__(...) | x.__len__() <==> len(x) | | __reduce__(...) | self.__reduce__() for pickling. | | __repr__(...) | x.__repr__() <==> repr(x) | | __setstate__(...) | self.__setstate__() for pickling. | | __str__(...) | x.__str__() <==> str(x) | | newbyteorder(...) | self.newbyteorder(<endian>) returns a copy of the dtype object | with altered byteorders. If <endian> is not given all byteorders | are swapped. Otherwise endian can be '>', '<', or '=' to force | a byteorder. Descriptors in all fields are also updated in the | new dtype object. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = <built-in method __new__ of type object> | T.__new__(S, ...) -> a new object with type S, a subtype of T ** What are the parameters? In other words, | what does ... stand for? ** | | alignment = <member 'alignment' of 'numpy.dtype' objects> | | | base = <attribute 'base' of 'numpy.dtype' objects> | The base data-type or self if no subdtype | | byteorder = <member 'byteorder' of 'numpy.dtype' objects> | | | char = <member 'char' of 'numpy.dtype' objects> | | | descr = <attribute 'descr' of 'numpy.dtype' objects> | The array_protocol type descriptor. | | fields = <attribute 'fields' of 'numpy.dtype' objects> | | | hasobject = <member 'hasobject' of 'numpy.dtype' objects> | | | isbuiltin = <attribute 'isbuiltin' of 'numpy.dtype' objects> | Is this a buillt-in data-type descriptor? | | isnative = <attribute 'isnative' of 'numpy.dtype' objects> | Is the byte-order of this descriptor native? | | itemsize = <member 'itemsize' of 'numpy.dtype' objects> | | | kind = <member 'kind' of 'numpy.dtype' objects> | | | name = <attribute 'name' of 'numpy.dtype' objects> | The name of the true data-type | | num = <member 'num' of 'numpy.dtype' objects> | | | shape = <attribute 'shape' of 'numpy.dtype' objects> | The shape of the subdtype or (1,) | | str = <attribute 'str' of 'numpy.dtype' objects> | The array_protocol typestring. | | subdtype = <attribute 'subdtype' of 'numpy.dtype' objects> | A tuple of (descr, shape) or None. | | type = <member 'type' of 'numpy.dtype' objects> [Dbg]>>> dt.num.__doc__ ** no doc string ** [Dbg]>>> help(dt.num) Help on member_descriptor object: num = class member_descriptor(object) | Methods defined here: | | __delete__(...) | descr.__delete__(obj) | | __get__(...) | descr.__get__(obj[, type]) -> value | | __getattribute__(...) | x.__getattribute__('name') <==> x.name | | __repr__(...) | x.__repr__() <==> repr(x) | | __set__(...) | descr.__set__(obj, value) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __objclass__ = <member '__objclass__' of 'member_descriptor' objects> [Dbg]>>> help(dt.num) Help on member_descriptor object: num = class member_descriptor(object) | Methods defined here: | | __delete__(...) | descr.__delete__(obj) | | __get__(...) | descr.__get__(obj[, type]) -> value | | __getattribute__(...) | x.__getattribute__('name') <==> x.name | | __repr__(...) | x.__repr__() <==> repr(x) | | __set__(...) | descr.__set__(obj, value) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __objclass__ = <member '__objclass__' of 'member_descriptor' objects> [Dbg]>>> help(dt.num.__objclass__) Help on class dtype in module numpy: class dtype(__builtin__.object) | Methods defined here: | | __cmp__(...) | x.__cmp__(y) <==> cmp(x,y) | | __getitem__(...) | x.__getitem__(y) <==> x[y] | | __len__(...) | x.__len__() <==> len(x) | | __reduce__(...) | self.__reduce__() for pickling. | | __repr__(...) | x.__repr__() <==> repr(x) | | __setstate__(...) | self.__setstate__() for pickling. | | __str__(...) | x.__str__() <==> str(x) | | newbyteorder(...) | self.newbyteorder(<endian>) returns a copy of the dtype object | with altered byteorders. If <endian> is not given all byteorders | are swapped. Otherwise endian can be '>', '<', or '=' to force | a byteorder. Descriptors in all fields are also updated in the | new dtype object. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = <built-in method __new__ of type object> | T.__new__(S, ...) -> a new object with type S, a subtype of T | | alignment = <member 'alignment' of 'numpy.dtype' objects> | | | base = <attribute 'base' of 'numpy.dtype' objects> | The base data-type or self if no subdtype | | byteorder = <member 'byteorder' of 'numpy.dtype' objects> | | | char = <member 'char' of 'numpy.dtype' objects> | | | descr = <attribute 'descr' of 'numpy.dtype' objects> | The array_protocol type descriptor. | | fields = <attribute 'fields' of 'numpy.dtype' objects> | | | hasobject = <member 'hasobject' of 'numpy.dtype' objects> | | | isbuiltin = <attribute 'isbuiltin' of 'numpy.dtype' objects> | Is this a buillt-in data-type descriptor? | | isnative = <attribute 'isnative' of 'numpy.dtype' objects> | Is the byte-order of this descriptor native? | | itemsize = <member 'itemsize' of 'numpy.dtype' objects> | | | kind = <member 'kind' of 'numpy.dtype' objects> | | | name = <attribute 'name' of 'numpy.dtype' objects> | The name of the true data-type ** How does this differ from what, in common | Python usage, is a class.__name__? ** | | num = <member 'num' of 'numpy.dtype' objects> ** What does this mean? ** | | | shape = <attribute 'shape' of 'numpy.dtype' objects> | The shape of the subdtype or (1,) | | str = <attribute 'str' of 'numpy.dtype' objects> | The array_protocol typestring. | | subdtype = <attribute 'subdtype' of 'numpy.dtype' objects> | A tuple of (descr, shape) or None. | | type = <member 'type' of 'numpy.dtype' objects> [Dbg]>>> ** There is no __module__ attribute. How does one identify the modules holding the code? ** |