Skip to content

Feature Request: Distinguish between "pre-move" and "post-move" comments in GameNode #1171

@aslyamov

Description

@aslyamov

Hi!

I am working with a data source that explicitly distinguishes between two types of comments for a specific move:

  1. Before the move (e.g., context or instructions given before the move is made).
  2. After the move (e.g., analysis or annotation of the move itself).

Currently, chess.pgn.GameNode seems to only support a single comment attribute.

If I have a sequence like:
{Comment Before} 1. e4 {Comment After}

I am forced to append {Comment Before} to the parent.comment (the previous node) and {Comment After} to the current node.comment. While this produces valid PGN text, it causes semantic issues in the object model:

  • If I iterate through the game nodes later, the "Comment Before" is logically attached to the previous move, not the current one.
  • It becomes difficult to parse the PGN back and separate which part of the text was intended as a "pre-move" note vs a "post-move" annotation.

Feature Request:
Would it be possible to introduce a mechanism to store pre-move comments separately?
For example, adding a pre_comment attribute to GameNode or ensuring that the Visitor can distinguish between comments appearing before the move token/SAN and comments appearing after it.

This would greatly help in preserving the structure of the original data.

Thanks for the great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions