Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17343
| From | Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Class: @property -> .__dict__ |
| Date | 2011-12-16 11:02 +0100 |
| Organization | A newly installed InterNetNews server |
| Message-ID | <jcf50g$716$1@r03.glglgl.gl> (permalink) |
| References | <ad04c206-dbfd-4e49-b365-943b47844c41@n6g2000vbg.googlegroups.com> |
Am 16.12.2011 09:52 schrieb Ulrich: > Could anyone please explain me why this does not work / how to get b > into .__dict__ / hint me to an explanation? b is not a data element of the particular instance, but it lives in the class. It is, roughly spoken, a "kind of method", just to be used without calling. These things are called "data descriptors" (http://docs.python.org/reference/datamodel.html#descriptors). t.b is internally reflected to te.__dict__['b'].__get__(t, te) in order to call the __get__ method of the property object. This is done on every call and the value is, in your case, derived from the instance value a. HTH, Thomas
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Class: @property -> .__dict__ Ulrich <ulrich@dorda.net> - 2011-12-16 00:52 -0800
Re: Class: @property -> .__dict__ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-16 09:03 +0000
Re: Class: @property -> .__dict__ Ulrich <ulrich.dorda@gmail.com> - 2011-12-16 01:11 -0800
Re: Class: @property -> .__dict__ Ulrich <ulrich.dorda@gmail.com> - 2011-12-16 01:14 -0800
Re: Class: @property -> .__dict__ Peter Otten <__peter__@web.de> - 2011-12-16 10:32 +0100
Re: Class: @property -> .__dict__ Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-16 09:23 -0700
Re: Class: @property -> .__dict__ Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-12-16 11:02 +0100
csiph-web