programming unlimited "categories" in python ?

Gabriel Ambuehl gabriel_ambuehl at buz.ch
Tue Oct 23 14:32:19 EDT 2001


-----BEGIN PGP SIGNED MESSAGE-----

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 hence you need some kind of
link.

>>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
even
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
data...




Best regards,
 Gabriel
b

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i

iQEVAwUBO9Wpp8Za2WpymlDxAQGgeAf+IknX8DozdjypiZxT3NO1zcyYGT93nS3N
mVqDKQ/wMdZv9ZsqxGskf9SaRBv2Wfin+Dz9foCZOXqUe4ynicp6QcU0RFB7DTYc
jWDfKXx+hJVYWjGjrNlrv0KQudqzxfyrOJ8igxZEgy3x2g28sXnIi84uCqwE8wLQ
xA9mKel0C4liNXs/BwVy+eavdBqwds8JSnL4Pu7xlaA+BokAfoW8AB6vf6Kn7OkR
y1gZIzNAQk8swMOuJd44NEuwSfSQCS7Ha98AMsybtSNIwf0FrqYw8yWcvetxX5lk
wBEnY27c7t+eXXqSkWmS4MqJngAzcI/U/wetymQFJrNtIkJZl1OB2A==
=A57+
-----END PGP SIGNATURE-----





More information about the Python-list mailing list