8000 __str__ with slot wrapper, generate slot with #[pymethod] by youknowone · Pull Request #6485 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@youknowone
Copy link
Member

Not sure this is a good idea or not.

Motivation: we have too many fragmented traits, which are easy to forget to add in with() attrs.

Now __str__ will more looking like a normal #[pymethod]. But what it backs will be very different. It actually doesn't create a real pymethod, but actually creating slot_str. And __str__ will be placed by a slot-wrapper descriptor.

This can be applicable to other single-method traits too.

Pros: Easy to understand. No worry to forget to add with()
Cons: Confusing because it have different semantics comparing to other real pymethods.

@coderabbitai
Copy link
Contributor
coderabbitai bot commented Dec 24, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@youknowone youknowone force-pushed the __str__ branch 3 times, most recently from f497438 to 05933fe Compare December 24, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0