Am 27.05.20 um 17:13 schrieb Peter Otten:
Die Reihenfolge kann durch die Positionierung in der Klasse bestimmt werden:
Könnte man machen, allerdings würde ich mich nicht darauf verlassen, dass die Reihenfolge in `vars(A).keys()` immer stimmt. Kannst Du mit eine Doku dazu zeigen, ich habe nichts gefunden. Allerdings hat mich Deine Mail noch auf einen ganz anderen Ansatz gebracht: class A: _myprop = 1.23 @property def myprop(self): return self._myprop @myprop.setter def myprop(self, value): if value < 2.5: self._myprop = value a = A() print(a.myprop) a.myprop = 2.1 print(a.myprop) -- Schönen Gruß Hartmut Goebel Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer Information Security Management, Security Governance, Secure Software Development Goebel Consult, Landshut http://www.goebel-consult.de Blog: https://www.goe-con.de/blog/35.000-gegen-vorratdatenspeicherung Kolumne: https://www.goe-con.de/hartmut-goebel/cissp-gefluester/2011-09-kommerz-uber-...