is it possible to set namespace to an object.
glomde
brkict at gmail.com
Mon Jan 21 13:56:57 EST 2008
On 21 Jan, 18:59, Wildemar Wildenburger
<lasses_w... at klapptsowieso.net> wrote:
> glomde wrote:
> > Hi,
>
> > is it somehow possible to set the current namespace so that is in an
> > object.
> > [snip]
> > set namespace testObj
> > Name = "Test"
>
> > Name would set testObj.Name to "Test".
>
> > [snip]
>
> > Is the above possible?
>
> Don't know, sorry. But let me ask you this: Why do you want to do this?
> Maybe there is another way to solve the problem that you want to solve.
The reason is that I do not want to repeat myself. It is to set up XML
type like
trees and I would like to be able to do something like.
with ElemA():
Name = "Top"
Description "Blahaha..."
with ElemB():
Name = "ChildA"
Description "Blahaha..."
....
This would be the instead of.
with ElemA() as node:
node.Name = "Top"
node.Description "Blahaha..."
with ElemB() as node:
node.Name = "ChildA"
node.Description "Blahaha..."
....
So to save typing and have something that I think looks nicer.
BR
/T
>
> /W
More information about the Python-list
mailing list