Trying to dynaimcally create properties at runtime with Python using reflected data?

Not sure that's what you want. But you could define dynamic read-only property with getattr and setattr method. Here is an example.

Not sure that's what you want. But you could define dynamic read-only property with getattr and setattr method. Here is an example: class X(object): data = {'x' : 123, 'y' : 456} def __getattr__(self, name): if name in self.

Data: return self. Dataname raise AttributeError(name) def __setattr__(self, name, value): if name in self. Data: return None return super(X, self).

__setattr__(name, value) a = X() print a. X, a. Y a.

X = 0 print a.x.

I think I'm deeper over my head than I thought... I'm having problems with (1), and I thought I had that nailed... – sr2222 Jun 30 '11 at 22:04.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions