From: Norbert N. <Nor...@gm...> - 2004-12-14 07:57:18
|
Am Montag, 13. Dezember 2004 19:31 schrieb Francesc Altet: > A Dilluns 13 Desembre 2004 18:53, Norbert Nemec va escriure: > > Using SyntaxError for non-pythonic identifiers is a nice idea, even > > though it should be noted that the following code: > > > > ---------- > > class A: > > pass > > a=A() > > setattr(a,"!$%#**",42) > > print a.__dict__ > > ---------- > > > > works fine and gives: > > > > {'!$%#**': 4} > > > > This attribute is therefore inaccessible by natural naming but still > > legal. Shouldn't pytables behave the same? > > I don't think so. Allowing that kind of identifiers would break natural > naming and that should be avoided for the sake of usability. Of course, natural naming is broken by that. On the other hand, natural naming may not always be feasible anyway. In my case, for example, I produce one .h5 file containing several groups. The core distinction between them is just one floating point parameter, say E, that runs over several values, say {0.0, 1.5, 2.3}. Most natural would be to call the groups "E=0.0", "E=1.5" and "E=2.3". Every other name I could give is artifical and meaningless. (Currently, I'm creating names like "data1", "data2" and "data3".) Natural naming is not an option anyway, since I'm looping over the groups all the time and even create them with a loop. Considering all of this, I would suggest that any kind of name should be allowed for nodes (are there any limitations given by HDF5?) Even reserved prefixes need not necessarily be prohibited. Everyone has to understand that they cannot be accessed by natural naming, but if you don't use that, why should you be unnecessarily restricted? I think this should be cleared first, since it might mean that we don't need any Exceptions for that case at all. Greetings, Norbert -- _________________________________________Norbert Nemec Bernhardstr. 2 ... D-93053 Regensburg Tel: 0941 - 2009638 ... Mobil: 0179 - 7475199 eMail: <No...@Ne...> |