Le mardi 18 octobre 2005 à 10:57 -0400, Barry Warsaw a écrit : > On Mon, 2005-10-17 at 23:46, Guido van Rossum wrote: > > > But I still like the version with strings better: > > > > x = property('get_x', 'set_x') > > > > This trades two lambdas for two pairs of string quotes; a good deal IMO! > > You could of course "just" do the wrapping in property(). I put that in > quotes because you'd have the problem of knowing when to wrap and when > not to, but there would be ways to solve that. But I won't belabor the > point any longer, except to ask what happens when you typo one of those > strings? What kind of exception do you get and when do you get it?
AttributeError when actually accessing the property, no? Guido's proposal seems quite nice to me. It helps group all property declarations at the beginning, and having accessor methods at the end with other non-public methods. Currently I never use properties, because it makes classes much less readable for the same kind of reasons as what Jim wrote: Le mardi 18 octobre 2005 à 09:37 -0400, Jim Jewett a écrit : > For me, the property declaration (including the function > declarations) is too verbose, and ends up hiding the rest > of the class. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com