Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndigits: make base and pad keywords #27908

Merged
merged 2 commits into from
Jul 6, 2018
Merged

ndigits: make base and pad keywords #27908

merged 2 commits into from
Jul 6, 2018

Conversation

rfourquet
Copy link
Member

My initial motivation was that ndigits(x, [base]) and log([base], x) do quite related things (ndigits(x, base) and log(base, x) are numerically close), but they take their arguments in reverse order, which is rather confusing. One fix would be to reverse the arguments of ndigits, but as ndigits is also closely related to digits, it seems nicer to use keywords, to follow the digits API. Also, this allows to specify pad while using the default value for base -- which also removes one TODO from the code :)

I had started to do the same for Base.ndigits0z, but I noticed some performance degradation, so I suspect that constant propagation does not happen with keyword argument... As ndigits0z may be used in somewhat more performance sensitive code and is not exported, I propose to keep its old API for now (and using pad=0 in ndigits has the same behavior as ndigits0z, so ndigits is enough for user-facing API).

@rfourquet rfourquet added the deprecation This change introduces or involves a deprecation label Jul 2, 2018
@rfourquet
Copy link
Member Author

Marking this for triage.

@rfourquet rfourquet added the triage This should be discussed on a triage call label Jul 5, 2018
@JeffBezanson
Copy link
Member

Agree; this seems like a pretty obvious place where we should be consistent.

@JeffBezanson JeffBezanson added this to the 0.7 milestone Jul 5, 2018
@StefanKarpinski
Copy link
Member

Triage approves. Restarting Travis; merge when it passes.

@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Jul 5, 2018
@JeffBezanson
Copy link
Member

The deprecation needed some tweaking, and I also happened to find some other missing deprecations at the same time.

@rfourquet rfourquet force-pushed the rf/ndigits-base-kw branch from f56e3ec to 1791d76 Compare July 6, 2018 14:32
@rfourquet
Copy link
Member Author

The deprecation needed some tweaking, and I also happened to find some other missing deprecations at the same time.

Nice thanks. In turn your new deprecations needed some tweaking :) Maybe this time will be good

@JeffBezanson JeffBezanson merged commit 6eed2fa into master Jul 6, 2018
@JeffBezanson JeffBezanson deleted the rf/ndigits-base-kw branch July 6, 2018 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants