作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
例如,假设我为AbstractFloat
写了一个函数,我想知道这个方法定义的影响,如何查看Base中AbstractFloat
的所有子类型?
最佳答案
您正在寻找 subtypes
:
Return a list of immediate subtypes of DataType T. Note that all currently loaded subtypes are included, including those not visible in the current module.
julia> subtypes(AbstractFloat)
4-element Array{Union{DataType, UnionAll},1}:
BigFloat
Float16
Float32
Float64
但有趣的是,Base
中只有一个:
julia> subtypes(Base, AbstractFloat)
1-element Array{Union{DataType, UnionAll},1}:
BigFloat
顺便说一句,PlotRecipes.jl 中有一个不错的食谱可视化类型树:
关于julia - 如何在 Julia Base 中找到抽象类型的子类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46851485/
我是一名优秀的程序员,十分优秀!