Terry Reedy <tjre...@udel.edu> wrote: > Delaney, Timothy (Tim) wrote: >> Terry Reedy wrote: >> >>>> The compiled code differs. >>> I *strongly* doubt that. Properties are designed to be transparent to >>> user code that access atrributes through the usual dotted name >>> notation precisely so that class code can be changed from >>> x = ob >>> to >>> x = property(get_x, set_x, del_x) >>> without changing user code. >> >> He was talking about C# with that statement. In C#, the compiled code >> differs depending on whether you use a property or an attribute. Or at >> least that's how I interpreted it. > > Checking back, I see now that Luis Z. went from Python > "It boggles me when I see python code with properties that only set and > get the attribute, or even worse, getters and setters for that > purpose. " to C#, and that Duncan was seemingly responding to the C# > part. If C# is like that, how inconvenient.
It's a long enough thread that I can't see anyone faulting you for falling asleep half way through my post. C# forces you to spend a lot of time writing trivial getters and setters. They've 'improved' it in the more recent versions: you no longer have to write any body at all for a trivial getter or setter and the compiler will generate one for you provided you have declared the property with a leading capital letter and a private attribute with the same name but a lowercase letter. Ick. > >> You are of course correct as to how Python does it. > > I guess I am spoiled ;-). > That's why we're all here. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list