ipython / ipython/traitlets

Confused about self.parent

Abierto
#840 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
653
Forks
217
Merge medio
2 d 21 h
PR fusionados (30 d)
2

Descripción

Hello, I am making heavy use of `self.parent` in some code I wrote, but:
1. [searching the docs](https://traitlets.readthedocs.io/en/stable/search.html?q=parent) does not define `parent`
2. searching [the repo](https://github.com/ipython/traitlets) for `def parent` does not yield any results
3. There are a number of red herrings in the search to understand what `self.parent` does and where it is documented because of toy examples in the issues and the docs where we have `class Child` and `Class Parent` where the `Child` class has a slot accessed via `self.parent` ... this is not the `self.parent` that is being heavily used in my Traitlets-based applications... but for the life of me, I cannot remember why I started using it and what the semantics are.

Actually I think [I found it](https://github.com/ipython/traitlets/blob/main/traitlets/config/configurable.py#L47) : it's defined as "The parent Configurable instance of this object." ... ah I think I know the purpose of this... it's to get at the Application class that is the parent of the Configurable class so that you can access slots within the Application... is that correct?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.