Hi all, I'm trying to store some data into pytables. Most of these are strings, 
their length varies in two values.
I can of course create a class with StringCol elements sized at the maximum 
value, to accommodate both. I was thinking, instead, to create two separate 
tables and insert values in this or that, depending on the string length.
In case of two values it's easy to implement two classes, unfortunately in real 
data these two values vary too (i.e. in my data can be 27 and 39, in other 16 
and 24...), so I would like to have a template class, which I can instantiate 
with proper values depending on what I found.
Problem is that I don't think I can safely override __init__() method for 
tables.IsDescription... 
In the end, two classes like

class MyEntry_long(tables.IsDescription):
  stream = tables.StringCol(39)

class MyEntry_short(tables.IsDescription):
  stream = tables.StringCol(26)

class MyEntry(tables.IsDescription):
  def __init__(self, par = 39):
    stream = tables.StringCol(par)

In other words, can I instantiate my entries passing parameters? maybe this is 
already possible in a more clean way :-)

Thanks

d
    


 
---
Davide Cittaro
daweonl...@gmail.com
http://sites.google.com/site/davidecittaro/

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to