Skip to content

Conversation

@OneSizeFitsQuorum
Copy link

@OneSizeFitsQuorum OneSizeFitsQuorum commented Nov 5, 2025

Allow 'size' parameter to be a callable that returns an int. So that we can set size properly here

Allow 'size' parameter to be a callable that returns an int.
@OneSizeFitsQuorum OneSizeFitsQuorum changed the title Update size parameter to accept callable Update size parameter to accept callable for callback.set_size() Nov 5, 2025
@martindurant
Copy link
Member

This is maybe OK, but I didn't understand the original issue.

Certainly, this PR should add documentation about how to use this change, and a test showing it in practice.

@OneSizeFitsQuorum
Copy link
Author

Thanks a lot for reviewing this! Maybe we can change this line from callback.set_size(getattr(f1, "size", None)) to callback.set_size(getattr(f1, "size", None)()) in here.
or add a wrapper function to ensure the parameters passed to set_size is a int, then we do not need update set_size(). What's your opinion?
image

@OneSizeFitsQuorum
Copy link
Author

@martindurant hi, could you please review this again~

@martindurant
Copy link
Member

I guess this is fine, but I still don't know why size would be a function: can you make a test case that hits this extra line?

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.

2 participants