On Wednesday 19 May 2004 08:31, Heiko Wundram wrote:
Am Mittwoch, 19. Mai 2004 06:41 schrieb Olaf 'Rübezahl' Radicke:
[snip senseless rant]
try: print "das war die Eingabe des Users: " + eingabe except UnicodeError: print "Wir unterbrechen den Vortrag kurz für eine" print "Raucher- und "Kaffee-Pause!!"
Was soll daran schiefgehen, ausser wenn Eingabe ein unicode-Objekt ist, welches sich nicht in Dein Console-Encoding übertragen lässt? :)
War stark vereinfacht.
Noch mal andersherum gefragt: Wenn Du eingabe schon auf ein Unicode-Objekt setzt, und Dir dann keine Gedanken machst, wie Du das sinnvoll ausgeben kannst (in Verbindung mit einem Nicht-Unicode string), dann ist was an Deinem Programm falsch, und nicht an Python. ;)
Das Problem ist das die Ausnahme immer nur zur Laufzeit festgestellt werden kann. Wenn das Prog startet heist es nicht, das es das tut was ich erwarte. Wenn ich Blöcke falsch setze, Klammernvergesse, unbekannte Namensräume benutze, bricht der Interpreter sofort ab. Ist ja auch sinnvoll. Niemand würde auf die Idee kommen zu sagen "Lass doch den Interpreter weiter laufen. Wenn der Programmierer ein Fehler macht, ist das halt sein Problem und nicht das von Python." Und wozu diese Typenfreiheit? Was ist der Vorteil? Ganz im Gegenteil: der Interpreter könnte ohne Typenfreihei sogar noch schneller sein. Der Preis ist (mir) auf die Dauer zu Hoch. Wenn Sun seine Java-Politik nicht ändert, denke ich das Mono quasi zur "Killer-Sprache" wird und das bieten kann, wo von Sun immer erzählt. Aber warten wir es ab... Olaf _______________________________________________ python-de maillist - python-de@python.net http://python.net/mailman/listinfo/python-de