[Python-checkins] r58929 - in python/trunk: Lib/test/test_descr.py Objects/descrobject.c

Guido van Rossum guido at python.org
Sun Nov 11 20:18:42 CET 2007


On Nov 11, 2007 10:35 AM, Fred Drake <fdrake at acm.org> wrote:
> On Nov 10, 2007, at 5:12 PM, guido.van.rossum wrote:
> > Issue 1416.  Add getter, setter, deleter methods to properties that
> > can be
> > used as decorators to create fully-populated properties.
>
> It's interesting that the test cases don't cover the use case of
> creating a property of a different name than the original, since that
> was something Guido specifically expressed an interest in.
>
> Admittedly, the decorator mechanism pretty much guarantees it'll work
> as described earlier in the discussions.
>
> If there are no objections, I can add some tests that demonstrate
> creating such use, probably some evening in the next few days.

Please do! The tests were a bit of a rush job.

On Nov 11, 2007 10:53 AM, Jim Jewett <jimjjewett at gmail.com> wrote:
> What does the D class show?  As nearly as I can tell, the only
> difference is that it won't raise an Exception if the attribute wasn't
> already there -- and this case isn't tested in either C or D.

It shows how you can subclass a property.

While admittedly there's no test that del C().foo raises an exception,
there *is* a test that del D().foo doesn't raise an exception; note
that it says "del d.foo" twice.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-checkins mailing list