A method in the second base class is not called even when the first base class is empty.

Abierto
#857 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript, python
Área
compilers

Línea de trabajo

Reproduce the supplied BaseClassA/BaseClassB/ClassC multiple-inheritance example and compare its Transcrypt output with CPython. Trace the compiler's handling of inherited init methods, then verify that the generated behavior matches CPython for this example.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

IS: bug?

Hi.

I found that a method in the second base class was not called when there was another base class in front of the second one. It seems that the first base class overrides the second one even when the first one has no method

Following is the code I tested:

class BaseClassA:
    def __init__(self, text):
        print('in __init__ in BaseClassA')
        self.text= text
class BaseClassB:
    pass
class ClassC(BaseClassB, BaseClassA):
    pass
def main():
    obj= ClassC('hello')
    print('obj.text= ', obj.text)
if __name__ == '__main__':
    main()

The output in CPython:

in __init__ in BaseClassA
obj.text=  hello

The output in Transcrypt:

obj.text=  None

I think that the first base class should override ONLY WHEN it has a method. It looks like a bug in class inheritance.

Thanks.

Lenguaje dominante
Python
Estrellas
2.9k
Forks
218
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TranscryptOrg/Transcrypt

Todos los issues de TranscryptOrg/Transcrypt

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.