Skip to content

Conversation

@hyanwong
Copy link
Member

@hyanwong hyanwong commented Sep 15, 2020

Fixes #846

@hyanwong hyanwong force-pushed the kw-only-simplify-args branch from 5b0eb43 to 65c7910 Compare September 15, 2020 09:22
@benjeffery
Copy link
Member

@hyanwong I just force-pushed to add tests for this and the other kwarg only methods. This is mainly so we don't add positional arguments in error in future.

@benjeffery benjeffery force-pushed the kw-only-simplify-args branch from 65c7910 to 4000c37 Compare September 15, 2020 10:15
@hyanwong
Copy link
Member Author

hyanwong commented Sep 15, 2020

Do we also want to make ts.trees() kwonly (and presumably most of the args to Tree.__init__)?

@hyanwong hyanwong force-pushed the kw-only-simplify-args branch from 4000c37 to f84705e Compare September 15, 2020 12:40
@hyanwong
Copy link
Member Author

I've added the kw-only stuff to .trees() as well, @benjeffery (in a separate commit), as Jerome gave that the thumbs up

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm slightly nervous about making tracked_samples kw-only, though, as I have a feeling there's a fair bit of coding using that. Are we sure all the documentation examples are ok with this?

I guess tsinfer is a good yardstick - if we don't break any code in there in things like the validation suite, then maybe it's OK. Still, breaking peoples code gratuitously for the sake of neatness isn't good.

@hyanwong
Copy link
Member Author

Looks good. I'm slightly nervous about making tracked_samples kw-only, though, as I have a feeling there's a fair bit of coding using that. Are we sure all the documentation examples are ok with this?

I could shift the asterisk so that tracked_samples can be positional? Whatever you prefer.

@jeromekelleher
Copy link
Member

I could shift the asterisk so that tracked_samples can be positional? Whatever you prefer.

This is probably safer, I think. No point in breaking code for the sake of it.

@hyanwong hyanwong force-pushed the kw-only-simplify-args branch from f84705e to aca2338 Compare September 15, 2020 16:04
@hyanwong
Copy link
Member Author

I could shift the asterisk so that tracked_samples can be positional? Whatever you prefer.

This is probably safer, I think. No point in breaking code for the sake of it.

Done, with new changelog. Ready to merge, I think.

@jeromekelleher
Copy link
Member

Great, thanks. It would be nice to test that trees([0]) is the same thing as trees(tracked_samples=[0]), just in case that asterisk gets moved by accident at some point.

@hyanwong
Copy link
Member Author

Great, thanks. It would be nice to test that trees([0]) is the same thing as trees(tracked_samples=[0]), just in case that asterisk gets moved by accident at some point.

Added test_tracked_samples_is_first_arg

@hyanwong hyanwong force-pushed the kw-only-simplify-args branch from aca2338 to 17cad82 Compare September 15, 2020 16:57
Copy link
Member

@benjeffery benjeffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benjeffery benjeffery force-pushed the kw-only-simplify-args branch from 17cad82 to fe9801b Compare September 15, 2020 22:03
@benjeffery
Copy link
Member

Just as I was about to merge I noticed the tests were not quite right, fixed and force pushed.

@mergify mergify bot merged commit 5a6e57d into tskit-dev:master Sep 15, 2020
@hyanwong hyanwong deleted the kw-only-simplify-args branch September 15, 2020 22:21
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.

Make all except first arg to simplify() keyword-only

3 participants