I would like to create my own atom class but appear to be doing something wrong. I basically just need a StringAtom but want to define a new class with a new PyTables 'kind' of 'link' instead of 'string.'
I have added the following code to the atom.py file... class LinkAtom(Atom): """ Defines an atom of type ``link``. The item size is the *maximum* length in characters of strings. """ kind = 'link' itemsize = property( lambda self: self.dtype.base.itemsize, None, None, "Size in bytes of a sigle item in the atom." ) type = 'string' _defvalue = '' def __init__(self, itemsize, shape=(), dflt=_defvalue): if not hasattr(itemsize, '__int__') or int(itemsize) < 0: raise ValueError( "invalid item size for kind ``%s``: %r; " "it must be a positive integer" % ('string', itemsize) ) Atom.__init__(self, 'S%d' % itemsize, shape, dflt) However, when I run ipython and import tables a LinkAtom and by extension a LinkCol is not created. Can someone tell me what I'm doing wrong? This method of generating class in PyTables doesn't seen to be very intuitive and/or pythonic. -Mike </pre>The contents of this electronic mail message and any attachments are confidential, possibly privileged and intended for the addressee(s) only.<br>Only the addressee(s) may read, disseminate, retain or otherwise use this message. If received in error, please immediately inform the sender and then delete this message without disclosing its contents to anyone.</pre> ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users