Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #4742

Re: [Python-de] Warum liefert // ein float?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christopher Arndt <chris@chrisarndt.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Warum liefert // ein float?
Date Thu, 6 Apr 2017 10:12:07 +0200
Lines 61
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>
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8FvNo10Q2lGMaXvIgCMxg9gcOw2qlbbpv"
X-Trace news.uni-berlin.de Dq14G71deWxxzapVFqf/EwRUBvxq2Xw/IWftsAe0khgA==
Return-Path <chris@chrisarndt.de>
X-Original-To python-de@python.org
Delivered-To python-de@mail.python.org
X-Virus-Scanned Debian amavisd-new at mx1.0x20.eu
Openpgp id=F0BA1EAE86651989C0A1C9901E0D97B33A4E1F31
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
In-Reply-To <ea8deb7d-44d8-4f77-3922-90e41b49a439@xgm.de>
X-BeenThere python-de@python.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Die Deutsche Python Mailingliste <python-de.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-de/>
List-Post <mailto:python-de@python.org>
List-Help <mailto:python-de-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <a5f1d6f1-89bf-b1f6-b688-c932620ce23f@chrisarndt.de>
X-Mailman-Original-References <ea8deb7d-44d8-4f77-3922-90e41b49a439@xgm.de>
Xref csiph.com de.comp.lang.python:4742

Show key headers only | View raw


[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


Thread

Re: [Python-de] Warum liefert // ein float? Christopher Arndt <chris@chrisarndt.de> - 2017-04-06 10:12 +0200

csiph-web