Arthur: > My thought is that it is highly preferable - except in highly unusual > circumstances - to call methods through method call syntax and to access > attributes through attribute access syntax. For reasons that are only > obvious - we know better whether we are accessing something akin to a > stored value or, in contrast, calling for something akin to a calculation > of a value. Which is information. Information is good.
And this is what I *don't* believe. I think it's preferable to make mytri.A (angle A) come across as an attribute, not a method call, even if I use a method call to compute it on the fly. I want to be able to express user intuitions about what's a method and what's an attribute drawing from a knowledge domain. I don't want to instruct a user in how Python must necessarily force a different view. If the user wants to know whether a method is being invoked, the user should just look at my source code (I think open source is highly preferable). > Is the inclusion of properties into Python in fact to any extent as Kirby > (and you, I think) seem to interpret it - an implicit vote on this matter? > Sure. A lot of us think properties are a good idea. *Every* feature added to Python may be seen as an implicit "vote" although the precise process whereby features get added is a little different from simple polling. > But its cost is the extent to which it influences outcomes in unintended > directions. If it was intended to influence toward greater use of the > technique of calling methods through attribute access syntax, it is an > unambiguous win. Because it - witness your statement above - undoubtedly > does. > Yes, an unambiguous win. Using attribute syntax to invoke methods is a good thing in some circumstances (they don't even have to be "unusual" circumstances). I think you're misplacing your distrust. If the source code is not available at all, that's one issue. There're lots of ways to hide information in that case, including back doors, trap doors, whatever. But properties are not about hiding the source. Properties are about making the control panel more rational and stable from a user's point of view (where the user may be oneself or another programmer). > If one believes - as do I - that there was no such intention, then the > addition of properties has suffered from the fate of having unintended > consequences. And in that sense cannot be viewed as an unambiguous win. > > Art I believe encouraging the use of attribute syntax to invoke methods behind the scenes is synonymous with managed access to class internals. It's what OO is encouraging and what Python is encouraging. I don't subscribe to your philosophy that we should avoid doing this. I do it, and will continue to do it, without apology. Kirby _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
