Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5640
| From | Hartmut Goebel <h.goebel@goebel-consult.de> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] "property-init"-decorator |
| Date | 2020-05-31 10:13 +0200 |
| Organization | Goebel Consult |
| Message-ID | <mailman.43.1590913385.24731.python-de@python.org> (permalink) |
| References | <875zci8zut.fsf@orrococo> <c36dda0a-50b6-7454-2da4-1f3bff5828cf@goebel-consult.de> <4719790.vIyLdRSyTD@palindrom> <9d687032-db10-2482-9455-540de7c9a3a4@goebel-consult.de> |
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-recht-fdp-die-gefaellt-mir-partei
Back to de.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
"property-init"-decorator ole-usenet-spam@gmx.net (Оlе Ѕtrеісhеr) - 2020-05-26 17:44 +0200 Re: [Python-de] "property-init"-decorator Julian Gethmann <mail.python.org@gethmann.org> - 2020-05-26 18:07 +0200 Re: [Python-de] "property-init"-decorator Hartmut Goebel <h.goebel@goebel-consult.de> - 2020-05-27 10:27 +0200 Re: "property-init"-decorator "Andreas B." <ab@sysing.de> - 2020-05-27 13:18 +0200 Re: [Python-de] "property-init"-decorator Gregor Engberding <gregor@landit.de> - 2020-05-27 17:04 +0200 Re: [Python-de] "property-init"-decorator Peter Otten <__peter__@web.de> - 2020-05-27 17:13 +0200 Re: [Python-de] "property-init"-decorator Hartmut Goebel <h.goebel@goebel-consult.de> - 2020-05-31 10:13 +0200 Re: [Python-de] "property-init"-decorator Peter Otten <__peter__@web.de> - 2020-05-31 15:37 +0200
csiph-web