Path as a dictionary tree key? (was Re: PEP on path module for standard library)

Ron Adam rrr at ronadam.com
Mon Aug 1 18:58:45 EDT 2005


Brian Beck wrote:
> Ron Adam wrote:
> 
>> This give a more general purpose for path objects.  Working out ways 
>> to retrieve path objects from a dictionary_tree also would be useful I 
>> think.  I think a Tree class would also be a useful addition as well.
>>
>> Any thoughts on this?
> 
> 
> I don't think this would be as useful as you think, for Path objects at 
> least.  Path objects represent *a* path, and building a tree as you have 
> proposed involves storing much more information than necessary.  For 
> instance, if I have the path /A/B/X, a tree-structured object would 
> logically also store the siblings of X and B (subpaths of B and A).


But you miss understand...  I'm not suggesting a path object be a tree, 
but it should/could be used as a key for accessing data stored in a tree 
structure.

The path object it self would be much the same thing as what is already 
being discussed.  Using it as a key to a tree data structure is an 
additional use for it.

Regards,
Ron






More information about the Python-list mailing list