A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-October/057066.html below:

[Python-Dev] __doc__ behavior in class definitions

[Python-Dev] __doc__ behavior in class definitions [Python-Dev] __doc__ behavior in class definitionsMartin Maly Martin.Maly at microsoft.com
Fri Oct 7 21:15:04 CEST 2005
Hello Python-Dev,
 
My name is Martin Maly and I am a developer at Microsoft, working on the
IronPython project with Jim Hugunin. I am spending lot of time making
IronPython compatible with Python to the extent possible.

I came across a case which I am not sure if by design or a bug in Python
(Python 2.4.1 (#65, Mar 30 2005, 09:13:57)). Consider following Python
module:

# module begin
"module doc"

class c:
    print __doc__
    __doc__ = "class doc"			(1)
    print __doc__

print c.__doc__
# module end

When ran, it prints:

module doc
class doc
class doc

Based on the binding rules described in the Python documentation, I
would expect the code to throw because binding created on the line (1)
is local to the class block and all the other __doc__ uses should
reference that binding. Apparently, it is not the case.

Is this bug in Python or are __doc__ strings in classes subject to some
additional rules?

Thanks
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4