[Python-Dev] cpython: asyncio: Fix CoroWrapper (fix my previous commit)
Guido van Rossum
guido at python.org
Thu Jan 16 20:03:46 CET 2014
Yeah the confusing thing is that omitting the docstring fixes it --
the class still has a __doc__ attribute but apparently it comes from
the metaclass. :-)
I guess you *could* have both a class and an instance __doc__ by
making a really clever descriptor, but it seems simpler to just use a
comment instead of a docstring. :-)
I'll do this now.
On Thu, Jan 16, 2014 at 8:14 AM, Christian Heimes <christian at python.org> wrote:
> On 16.01.2014 16:57, Guido van Rossum wrote:
>> Because somehow you can't have a slot named __doc__ *and* a docstring
>> in the class. Try it. (I tried to work around this but didn't get very
>> far.)
>
> That's true for all class attributes. You can't have a slot and a class
> attribute at the same time. After all the __doc__ string is stored in a
> class attribute, too.
>
>>>> class Example:
> ... __slots__ = ("egg",)
> ... # This doesn't work
> ... egg = None
> ...
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: 'egg' in __slots__ conflicts with class variable
>
>
>>>> class Example:
> ... """doc"""
> ... __slots__ = ("__doc__",)
> ...
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: '__doc__' in __slots__ conflicts with class variable
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org
--
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev
mailing list