Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4742
| From | Christopher Arndt <chris@chrisarndt.de> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] Warum liefert // ein float? |
| Date | 2017-04-06 10:12 +0200 |
| Message-ID | <mailman.170.1491466335.2961.python-de@python.org> (permalink) |
| References | <ea8deb7d-44d8-4f77-3922-90e41b49a439@xgm.de> <a5f1d6f1-89bf-b1f6-b688-c932620ce23f@chrisarndt.de> |
[Multipart message — attachments visible in raw view] - view raw
Am 06.04.2017 um 09:52 schrieb Florian Lindner: > Warum liefert // ein float zurück, obwohl das Ergebnis, immer eine eine Ganzzahl ist (in dem Sinne, dass es keine > Nachkommestellen hat)? Der Grund ist die Python Type Coercion. Bei Operationen mit unterschiedlichen Typen der Argumente, werden beide vor der Operation zu einem gemeinsamen, kompatiblen Typ konvertiert, der dann auch den Typ des Ergebnisses bestimmt. Daher auch: 10 // 3 == 3 Chris
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] Warum liefert // ein float? Christopher Arndt <chris@chrisarndt.de> - 2017-04-06 10:12 +0200
csiph-web