Sreenivas Reddy T <thatiparthysreeni...@gmail.com> writes: > this is happening on python 2.6 too. > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> class Test(type): > ... __doc__= > File "<stdin>", line 2 > __doc__= > ^ > SyntaxError: invalid syntax >>>> class Test(type): > ... __doc__='asasdas' > ... >>>>
I don't get any syntax errors (Python2.7 and 2.6) >>> class Test(object): ... __doc__ = "Something" ... >>> >>> help(Test) >>> class Test(type): ... __doc__ = "something" ... >>> help(Test) >>> Test.__doc__ 'something' >>>> Test.__doc__='sadfsdff' > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: attribute '__doc__' of 'type' objects is not writable >>>> type(Test) > <type 'type'> >>>> The __name__, __bases__, __module__, __abstractmethods__, __dict__ and __doc__ attributes have custom getters and setters in the type object definition. __doc__ has only a getter. No setter and no deleter. http://hg.python.org/cpython/file/0b5ce36a7a24/Objects/typeobject.c#l658 That is why you're seeing this. What's the question here? [...] -- ~noufal http://nibrahim.net.in May I ask a question? _______________________________________________ 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