Skip to content

Improve string representation of Advanced(Inc)Subtensor#1931

Open
AdishreeB wants to merge 1 commit intopymc-devs:v3from
AdishreeB:enh-advanced-subtensor-repr
Open

Improve string representation of Advanced(Inc)Subtensor#1931
AdishreeB wants to merge 1 commit intopymc-devs:v3from
AdishreeB:enh-advanced-subtensor-repr

Conversation

@AdishreeB
Copy link
Copy Markdown

Moves str_from_slice and str_from_indices from Subtensor to BaseSubtensor and adds a shared str method. AdvancedIncSubtensor and IncSubtensor now use super() to call these methods. AdvancedSubtensor inherits str directly from BaseSubtensor.

Related Issue

Checklist

  • Checked that the pre-commit linting/style checks pass
  • Included tests that prove the fix is effective or that the new feature works
  • Added necessary documentation (docstrings and/or example notebooks)
  • If you are a pro: each commit corresponds to a relevant logical change

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@ricardoV94 ricardoV94 changed the title refactor __str__ methods to use BaseSubtensor Improve string representation of Advanced(Inc)Subtensor Mar 4, 2026
Move str_from_slice, str_from_indices, and __str__ to BaseSubtensor so
that Subtensor, AdvancedSubtensor, and other subclasses inherit a
consistent string representation. Only IncSubtensor and
AdvancedIncSubtensor override __str__ for custom naming.

Closes pymc-devs#1906

Co-authored-by: Adishree <jellybeing315@gmail.com>
Co-authored-by: Aman Srivastava <amansri345@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced(Inc)Subtensor text representation

2 participants