From: russ <ru...@ag...> - 2005-01-21 07:00:18
|
> it might make sense to do '/' parsing in __getitem__, such > that something["abc/djk"] is internally read equivalently > to something["abc"]["djk"] Actually I'd disagree with that. I think the beauty of allowing any arbitrary string in the __getitem__ is that anything is allowed; there are no special cases for the programmer to have to worry about. It is very simple to use. It doesn't make sense to me to provide a special interpretation for the "/" character purely in order to save typing a few characters in an interactive session. In general, where the programmer knows the structure of the database in advance and preassigns all the names, then using the natural naming (__getattr__) adds a lot in readability and interactive exploration. In the other case where the programmer doesn't know the structure in advance, and the names are chosen, for example, by the user, then you're going to use the __getitem__ method of node retrieval since the names are already in variables to begin with. To mix up these two common situations in a halfway measure doesn't make any sense. Cheers, -Russ |