[Python-Dev] Bug 7183 and Python 2.6.4

Georg Brandl g.brandl at gmx.net
Thu Oct 22 21:47:26 CEST 2009


Tres Seaver schrieb:
> Barry Warsaw wrote:
>> On Oct 22, 2009, at 10:47 AM, Benjamin Peterson wrote:
> 
>>> 2009/10/22 Barry Warsaw <barry at python.org>:
>>>> So does anybody else think bug 7183 should be a release blocker for  
>>>> 2.6.4
>>>> final, or is even a legitimate but that we need to fix?
>>> I think it cannot hold up a release with out a reproducible code  
>>> snippet.
> 
>> It may not be reproducible in standard Python, see David's follow up  
>> to the issue.  If that holds true and we can't reproduce it, I agree  
>> we should not hold up the release for this.
> 
> The fix for 5890 has a funny "smell" to me: copying __doc__ into the
> instance dict just feels wrong.  How does that work with a pure Python
> class using slots?  E.g.:
> 
>   class MyProp(property):
>       pass
> 
>   class Foo(object):
>       @property
>       def bar(self):
>           '''Get a bar.'''
> 
>       @MyProp
>       def baz(self):
>           '''Get a baz.'''
> 
>   print Foo.bar.__doc__
>   print Foo.baz.__doc__
> 
>   class SlottedFoo(object):
>       __slots__ = ()
>       @property
>       def bar(self):
>           '''Get a bar.'''
> 
>       @MyProp
>       def baz(self):
>           '''Get a baz.'''
> 
>   print SlottedFoo.bar.__doc__
>   print SlottedFoo.baz.__doc__

Works just fine.  I think you meant

class MyProp(property):
    __slots__ = ()

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list