This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients aviral, brandtbucher, kebab-mai-haddi, steven.daprano, terry.reedy
Date 2021-01-27.22:34:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The answer, Aviral discovered,  is that current ast nodes have end_lineno attributes, so the patch amounts to consistently copying them.

I don't understand Aviral's use case either, but an item on my IDLE wish list is to be able to move class and function definitions within a file by moving the Class and Function entries within the browser tree.  This requieres end lines and having it be an attribute is easier and more accurate than recalculating it.  Merely clicking on an entry could highlight the whole definition.  Other people might think of other uses.

An issue in the patch is inserting parameter 'end_line' after 'line'.  Normally, new parameters have to go at the end, but:

1. Inserting 'end_line' after 'line' makes the code easier to read.

2. The parameter or parameters at the end have default values.  If we added 'end_line=None', we would have to consider what to do when it is omitted.

3., which I rewrote in 2017, documents readline and readline_ex as the public call interface.  They return a hierarchical structure that includes Functions and Classes in the dict values.  Their signatures are intentionally omitted and the attributes are only listed after saying "Users are not expected to create instances of these classes."

I posted "What is the pyclbr public API" to pydev asking about this issue.
Date User Action Args
2021-01-27 22:34:04terry.reedysetrecipients: + terry.reedy, steven.daprano, brandtbucher, aviral, kebab-mai-haddi
2021-01-27 22:34:04terry.reedysetmessageid: <>
2021-01-27 22:34:04terry.reedylinkissue38307 messages
2021-01-27 22:34:04terry.reedycreate