Re: Python: "dynamische" Klassenvariablen?

Andreas Jung <[email protected]>
Newsgroups gmane.comp.web.zope.german
Organization ZOPYX Ltd & Co. KG
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jens W. Klein wrote:
> Am Donnerstag, den 04.02.2010, 10:09 +0100 schrieb Peter
> Zechmeister:
>>> warum nicht danach überhaupt nur:
>>>
>>> TestClass[name] = PageTemplateFile(filepath)
>> OK. Ich geb mir die Antwort selbst: Weil es nicht geht.
>>
>>>>> class A():
>> ...  pass ...
>>>>> A.a=1 A['b']=2
>> Traceback (most recent call last): File "<stdin>", line 1, in
>> <module> TypeError: 'classobj' object does not support item
>> assignment
>
> Ah, dacht ich mir schon und wunderte mich das es geht. Nach dem
> Motto, die Wege des Zope2 sind unergründlich :-) na dann.
>
> l

setattr(A, 'b', 2)

?

Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktqmhQACgkQCJIWIbr9KYwWagCgttbpKJ52h1JBHkLIFb6IomT9
H7QAoLwtY37iewPNpqPhCEwTnsl/dNFs
=inkC
-----END PGP SIGNATURE-----



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lists.vcf (text/x-vcard, 331 B)
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd. & Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[email protected]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.