On Tue, 2006-04-04 at 09:57 -0700, Guido van Rossum wrote: > On 4/3/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > > I've been thinking that `hash` could be an attribute (or property if it > > needs to be calculated on-the-fly) rather than the current method call. > > > > Or it could be an easy thing to add to the "won't change" PEP ... > > The latter, please. > > We apparently need more guidance for when it's appropriate to turn > something into an attribute. I don't have time to write that up right > now; if someone else can give it a shot, I'd appreciate it; or I'll > come back to this topic later.
Just a data point. In our API, we've been converting all of our no-arg methods to attributes/properties, each of which may or may not be writable of course. It's simplified our Python code enormously, and made it much more readable. Certainly "foo.get_something()" and "foo.set_something(thing)" are much better spelled "foo.something" and "foo.something = thing". As a general principle, we've been making this conversion for any getters and setters that take no arguments, both for pure-Python types and C-implemented types. While we were at it, we changed everything that returns a newly formed concrete sequence to returning an iterator (which broke code that was doing random access into the sequence, but that's another story). I don't know whether Python 3000 wants to encourage that style, but it works well for us. -Barry
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com