[Python] un bel dilemma

Carlo Miron miron a python.it
Mar 28 Lug 2015 16:14:15 CEST


2015-07-28 16:04 GMT+02:00 enrico franchi <enrico.franchi a gmail.com>:

> 2015-07-28 13:39 GMT+01:00 Carlo Miron <miron a python.it>:
>> > Ehm... *se* fosse Python valido, quell'if valuterebbe sempre a vero (a =
>> > 3,
>> > varrebbe 3) e stamperebbe 3.
>>
>> e chi te lo dice? conosco almeno un (meraviglioso™) linguaggio in cui
>> il valore restituito sarebbe il-valore-precedente-di-a.
>
> Diciamo che lo riterrei parecchio probabile... a che linguaggio ti riferisci
> per inciso?

Ovviamente a Pony, che domande.
<http://www.ponylang.org/>

>> cosa intendi, scusa? </gnurant>
>
> Allora, se vuoi modellare una computazione fal punto di vista formale, hai
> bisogno che ogni "operazione" abbia un tipo.
> O per lo meno lo fai se stai facendo type-theory.

Pony ha la clausola `else` appiccicabile a tutte le strutture di
controllo¹, per gestire questo caso (in alternativa, restituisce
implicitamente `None`).

¹ <http://tutorial.ponylang.org/expressions/control-structures/>

©

-- 
|:**THE BEER-WARE LICENSE** (Revision 42):
| <miron a python.it> wrote this mail. As long as you retain
| this notice you can do whatever you want with this stuff.
| If we meet some day, and you think this stuff is worth it,
| you can buy me a beer in return.
|                                            --Carlo Miron :


Maggiori informazioni sulla lista Python