Question about dictionaries (Question about is ?)
Matt Gushee
mgushee at havenrock.com
Sun Jan 9 10:01:36 EST 2000
Felix Thibault <felixt at dicksonstreet.com> writes:
> >> or something, or is this just a Stupid Programming
> >> Trick?
> >
> >Hah! Your next challenge is to find a use for this interesting
> >technique. If you can do that, it won't be just a Stupid Programming
> >Trick ;-)
>
> Well the use I have is building a nested dictionary out of
> some HTML...near the beginning of the program I make
> a dictionary with the tags in the document for keys, so
> it's easy to make everything downhill from that point to the
> same 20 or so slices of the document instead of pointing
> to hundreds ... Which is simpler for me to think about, but
> I'm getting the idea that the computer doesn't care.
Well, it's at least a fascinating experiment. And without knowing in
more detail what you're trying to accomplish, it's hard to say for
sure, but my impression is that perhaps you're being a little too
clever. If you can keep straight which of these indirect object
references is referring to what (as apparently you can) you're smarter
than I am. But when you start trying to process real HTML documents
with all their idiosyncracies, you might have an enormous mess on your
hands.
In summary: if you're just playing around to see how things work,
don't let me or anybody else stop you. But if you are trying to
produce some useful code in a reasonable amount of time, you might
start by looking at how other people have dealt with HTML. If you look
around The Vaults of Parnassus (http://www.vex.net/parnassus/), I'm
sure you'll find something to do with HTML. The XML-SIG might also
give you some ideas.
Best of luck!
--
Matt Gushee
Portland, Maine, USA
mgushee at havenrock.com
http://www.havenrock.com/
More information about the Python-list
mailing list