[issue24005] Documentation Error: Extra line Break
New submission from Jaivish Kothari:
https://docs.python.org/2/whatsnew/2.4.html?highlight=decorators#pep-318-dec...
'''
def require_int (func):
def wrapper (arg):
assert isinstance(arg, int)
return func(arg)
return wrapper
'''
New line is ommited before return wrapper
'''
def require_int (func):
def wrapper (arg):
assert isinstance(arg, int)
return func(arg)
return wrapper
'''
----------
assignee: docs@python
components: Documentation
messages: 241508
nosy: docs@python, georg.brandl, janonymous
priority: normal
severity: normal
status: open
title: Documentation Error: Extra line Break
type: enhancement
versions: Python 2.7
_______________________________________
Python tracker
Jaivish Kothari added the comment:
Please find the attached patch for review.
----------
keywords: +patch
resolution: -> fixed
Added file: http://bugs.python.org/file39118/doc_patch.patch
_______________________________________
Python tracker
Georg Brandl added the comment:
Why is this a bug?
----------
_______________________________________
Python tracker
Carol Willing added the comment:
janonymous, Thanks for the contribution. I agree with George that this is not a bug. The whitespace exists for developer readability and maintainability of code. Here's a section from PEP8 about the use of whitespace (https://www.python.org/dev/peps/pep-0008/#id15). I am closing this issue as not a bug. I do hope you will contribute to Python again. Thanks.
Close as not a bug.
----------
nosy: +willingc
resolution: fixed -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker
Tim Golden added the comment:
One small thing to bear in mind is that the existing code (ie with the extra linefeed) raises an IndentationError if cut-and-pasted into the interactive interpreter; with the OP's change, it succeeds. Might not have been their intention, but certainly is the case.
(Doesn't make it a bug, as such, but makes it more than a stylistic difference of opinion).
----------
nosy: +tim.golden
_______________________________________
Python tracker
Carol Willing added the comment:
Tim, A good point re: the interpreter. I've attached an output from IPython interpreter.
Georg, Given Tim's additional insight, I'm inclined to reopen the issue and review the patch as a positive change. Though not a bug, but as an enhancement for learners to copy-paste doc code into an interpreter. Thoughts?
----------
Added file: http://bugs.python.org/file39130/Screen Shot 2015-04-19 at 12.19.07 PM.png
_______________________________________
Python tracker
Berker Peksag added the comment:
That document is 10 years old :) I don't think it's worth to change now. Also, "what's new" documents shouldn't be used as a tutorial. There are many tutorials about writing decorators on the internet.
(Thanks for the report and the patch, Jaivish)
----------
nosy: +berker.peksag
_______________________________________
Python tracker
Georg Brandl added the comment:
Yeah, agreed.
----------
_______________________________________
Python tracker
Tim Golden added the comment:
(Laughs). I admit, I was so close to the trees, I missed the fact that
the doc is, as you say, a What's New, and for Python 2.4. Agree that to
change this now would be somewhat ludicrous.
If some similar patch were proposed to some more current, relevant
document I'd still be at least open to the change proposed for the
reasons I gave but let's close this one now.
----------
_______________________________________
Python tracker
Jaivish Kothari added the comment:
Thanks for support . I agree it is not a bug at all but just as Tim said it would be easy to copy paste code directly to interpreter with such changes. This was my first contribution in python though not accepted , it is ok :) . I'll try to contribute more towards it .Thanks for commenting . Could you guys suggest some issues i could work on as a beginner :)
----------
_______________________________________
Python tracker
Tim Golden added the comment:
Jaivish Kothari,
Thanks for making the effort to contribute. Can I suggest you have a
look at the Core Mentorship site:
http://pythonmentors.com/
and perhaps join the Core Mentorship list:
http://mail.python.org/mailman/listinfo/core-mentorship
TJG
----------
_______________________________________
Python tracker
Jaivish Kothari added the comment:
Thank you Tim.
----------
_______________________________________
Python tracker
participants (5)
-
Berker Peksag
-
Carol Willing
-
Georg Brandl
-
Jaivish Kothari
-
Tim Golden