-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
WIP: Add NEWS entry and docs for new BitArray constructors #19042
Conversation
Usually just using """
BitArray(dims::Integer...)
BitArray(dims::NTuple{N,Int})
Construct an uninitialized `BitArray` with the given dimensions. Behaves identically
to the [`Array`](:func:`Array`) constructor.
"""
BitArray{N}(::Union{Vararg{Integer}, NTuple{N, Int}}) throws an error
so I suppose that approach won't work here. Perhaps the simplest would be to split that docstring into two separate ones that describe the differences between the two constructors, maybe with a doctest each. Or just leave it attached to the (We should also be moving docstrings out of |
That was my temporary solution, it's not too bad except it gives the wrong help for
I just copied what was done in the other cases since I lost track of how things work exactly. Should I just move the help strings to |
The new constructors were introduced in #19018. The docs are actually also for the old constructors. [ci skip]
3b6e28c
to
9818531
Compare
Ok I moved the docs out of helpdb. |
@@ -53,6 +53,9 @@ Library improvements | |||
`countfrom`, `take`, `drop`, `cycle`, `repeated`, `product`, `flatten`, `partition`) have been | |||
moved to the module `Base.Iterators` ([#18839]). | |||
|
|||
* BitArrays can now be constructed from arbitrary iterables, in particular from generator expressions, | |||
e.g. BitArray(isodd(x) for x = 1:100) [#19018]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be code highlighted. would really prefer leaving pr's open long enough for them to get reviewed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, fixed in 3f7891a.
BitArray{N}(dims::NTuple{N,Int}) = BitArray{N}(dims...) | ||
# note: the docs for the two signatures are unified, but only | ||
# the first one is recognized by the help system; it would be nice | ||
# to fix this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open an issue for this, rather than just a comment in here? (Otherwise this will probably get forgotten.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #19062.
@@ -342,6 +342,40 @@ Constructors | |||
1 1 | |||
1 1 | |||
|
|||
.. function:: BitArray(dims::Integer...) | |||
.. function:: BitArray{N}(dims::NTuple{N,Int}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only have a single .. function::
, i.e.
.. function:: BitArray(dims::Integer...)
BitArray{N}(dims::NTuple{N,Int})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 438d1ea, thanks.
This is for the new constructors that were introduced in #19018, and the old constructors as well.
I'm issuing a PR because I can't find out how to document the old constructors correctly. The relevant lines are here. For the old constructors, I have two signatures, which are basically
BitArray(n1, n2, n3, ...)
andBitArray((n1,n2,n3))
, but I don't know how to create a single signature for the two (I could only specify one). I also can't just do it like in the docs forArray
, because the generic signatureBitArray(iters)
is used for the "generic iterable" constructor.cc @MichaelHatherly.