Zum Inhalt
Alle Apps

Operatoren sind Methoden

Über diese App

Welche Methode ruft a * b? Ein Ablaufbild zeigt die zwei Stationen a.__mul__(b) und b.__rmul__(a) mit den Ausgängen Ergebnis, NotImplemented und Fehler. Mit Zahlen, Strings, Listen, Brüchen in vier Ausbaustufen (isinstance, __rmul__, __eq__) und Läufen mit und ohne __lt__: warum 3 * Bruch(1, 2) erst am int scheitert und dann bei __rmul__ landet.

Fach: Informatik

Mehr aus Informatik

Eine VisuApp von heyprof: interaktiv, kostenlos im Browser, ohne Anmeldung. Was ist eine VisuApp? · Alle Apps