From: Norbert N. <Nor...@gm...> - 2004-12-13 17:53:52
|
Hi there, starting to sort out some of the raised exceptions, I hit another case that I don't know how to solve: utils.checkNameValidity currently raises NameErrors when a name uses a reserved prefix or is not a legal python identifier. In contrast to that, documentation states in several places that the latter case causes a SyntaxError. Following the Python documentation, NameError is meant for local and global symbols only. Despite the appealing name, I'm therefore not sure whether it is a good idea to use it for this purpose. 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? In any case, the correct error to raise in the first case would seem to be ValueError. I'm really confused now. Anybody has better ideas? Greetings, Norbert -- _________________________________________Norbert Nemec Bernhardstr. 2 ... D-93053 Regensburg Tel: 0941 - 2009638 ... Mobil: 0179 - 7475199 eMail: <No...@Ne...> |