我已经在Python中导入了一个类:
from mxnet.ndarray import NDArray
现在,我想获取一个type
对象而没有初始化NDArray
的实例。在Scala中,我会这样做:
val t = classOf[NDArray]
有没有办法在Python中做到这一点?
答案 0 :(得分:0)
对不起,刚刚意识到在Python中静态对象和类/类型之间没有区别,因此可以将NDArray与类型对象直接进行比较:
import Modal from 'react-modal';
class Homepage extends Component {
constructor(props) {
super(props)
this.state = { modalOpen: false };
this.handleOpenModal = this.handleOpenModal.bind(this)
}
handleOpenModal() {
this.setState({ modalOpen: true });
}
render() {
return(
<div className="homepage">
<button onClick={this.handleOpenModal}>open the modal</button>
<Modal open={this.state.modalOpen}>
<ModalContent />
</Modal>
</div>
)
}
}
const ModalContent = () => {
return(
<div>this is the content I want to render inside the modal</div>
)
}