-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Il 07/12/2011 18:17, Giampaolo Rodolà ha scritto: > [...] >> Non devi neanche gestire le eccezioni, è chiaro che è molto implicito e che >> sa un po' di quick and dirty, ma >> 1) in alcuni casi non serve >> 2) e se serve allora hai sbagliato linguaggio :-( > > Scusa ma con tutta la buona volontà non riesco a digerire una cosa di > questo tipo: > > php > print '3viso'+2; > 5 >
Scusa, ma di cosa vi scandalizzate? Anche Common Lisp lo permette, almeno 10 anni prima di PHP: $clisp -q -norc [1]> (setf (fdefinition 'read-string) (get-macro-character #\")) #<SYSTEM-FUNCTION SYSTEM::STRING-READER> [2]> (set-macro-character #\" #'(lambda (stream char) (let* ((buf (read-string stream char)) (n (parse-integer buf :junk-allowed t))) n))) T [3]> (+ "3viso" 2) 5 > [...] Ciao Manlio -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7k91UACgkQscQJ24LbaUT1mACfV3jTGNBqgH7opuzj5uiDfKSH +60AnRi3sxH+Wnu2NGP3xMTuBw3Yn4t9 =TwU5 -----END PGP SIGNATURE----- _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python