Changing the class of an instance

Richard Tobin richard at cogsci.ed.ac.uk
Sun Jul 16 15:35:41 EDT 2000


In article <8kq8kc$guk$1 at nnrp1.deja.com>,  <david_ullrich at my-deja.com> wrote:

>    So it's something like the value of infoset.__class__
>changes when you call infoset.validate(schema)? 

Very like that - it's changing the class of some objects in the
infoset, not the infoset itself.

>but I really don't see the point
>to changing the class of the object instead of just constructing
>a new object.

None, except to directly model the XML Schema specification which
talks in terms of adding properties to info items in an existing
infoset.

> Like you pass a WellFormedInfoset to something
>or call some method of one and get back an instance of a
>subclass of ValidInfoset.

Some other XML transformations (eg style-sheet application) are
defined as infoset->infoset functions in that way, but this one isn't.

Sometimes the aim of a program isn't (or isn't just) to calculate a
result reliably, but to do it in a particular way to illustrate and
explore an algorithm.

-- Richard
-- 
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

"The Internet is really just a series of bottlenecks joined by high
speed networks." - Sam Wilson



More information about the Python-list mailing list