programming unlimited "categories" in python ?

Lucio Torre lucio at
Tue Oct 23 21:11:54 CEST 2001

At 08:32 PM 23/10/2001 +0200, Gabriel Ambuehl wrote:
>Hello Lucio,
>Tuesday, October 23, 2001, 6:49:03 PM, you wrote:
> >>You still need a link between the two, else you haven't got any
> >>chance
> >>to match them anyway so why not just build the region tree and
> >>store all the data under it? then you query for africa first and
> >>fetch only the results which have got the attribute deadly in 5
> >>hours?
> > you can match them using intersections. you get all the children
> > for every node in all the categories you want, then intersect them
> > all.
>But you can only intersect them if you have some additional
>information about which apply to which he

if i have a tree, i can get the children from one node.
if i have two list of children, i can compare them and see where they 
intersect. (equal records)

not the prettiest thing to do in sql maybe. but thats how you cross both 
selections. as i said, the categorization data is not in the data point 
structure, but in the tree. and thats how you get unlimited.

>nce you need some kind of
> >>I wasn't thinking about the implementation itself but mostly about
> >>suitable approaches. IMHO, you should try to squeeze your data
> >>model into ONE tree and the problem is almost solved.
> > so you do this tree:
> > africa
>- ->> mozambique
>- -- >> capital
>- ---->> deadly
>- ------>> really deadly
>- ------>> not so deadly
>- --->> deadly
>- ----->> really deadly
>- ----->> not so deadly
>- -->> deadly
>- ---->> really deadly
>- ---->> not so deadly
>- ->> deadly
>- --->> really deadly
>- --->> not so deadly
> > but suppose you suddently have cases of a kinda deadly thing. you
> > have to edit the whole tree!
>Why? Personally, I'd simply save the deadly stuff in a string (or
>integer) so I can easily add another mode if need be.
> > but you can have that if you hard code the tree. but what if you
> > have some subset (really deadly, or spooky deadly.. or whatever, in
> > the query you are doing) and want to find out the africa tree?
>I think Python's polymorphism allows for a not so hard coded
>kind of tree as Python won't care what type of object you put into

yeah, but thins thing you are propossing, is one of the reasons people want 
to switch from RDBMS to OODMS! and we are dealing with sql here.


More information about the Python-list mailing list