[Python] 10 myths

Marco Santamaria marco.santamaria a gmail.com
Mer 25 Mar 2015 16:01:11 CET


Il giorno 25 marzo 2015 11:50, Nicola Larosa <nico a teknico.net> ha scritto:

> Simone Federici wrote:
> > {
> > ma quanto mi disturbano le parentesi...
> > }
>
> Eh, ormai ci ho rifatto il callo.
>
> Pochi programmatori apprezzano il genio dell'indentazione significativa:
> sarebbe stato un problema per l'adozione del linguaggio, ancor pių dello
> svantaggio di non poter avere funzioni anonime inline.
>
> Non credo che Pike e Thompson si siano proprio posti il problema se
> mettercele o meno.
>

Pare che se lo siano posto il problema. In questo articolo
<https://talks.golang.org/2012/splash.article> viene motivata la scelta di
evitare l'indentazione per delimitare i blocchi di codice:


Some observers objected to Go's C-like block structure with braces,
> preferring the use of spaces for indentation, in the style of Python or
> Haskell. However, we have had extensive experience tracking down build and
> test failures caused by cross-language builds where a Python snippet
> embedded in another language, for instance through a SWIG invocation, is
> subtly and *invisibly* broken by a change in the indentation of the
> surrounding code. Our position is therefore that, although spaces for
> indentation is nice for small programs, it doesn't scale well, and the
> bigger and more heterogeneous the code base, the more trouble it can cause.
> It is better to forgo convenience for safety and dependability, so Go has
> brace-bounded blocks.



Ma non riesco a digerire questo fatto...
-------------- parte successiva --------------
Un allegato HTML č stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20150325/c3653d40/attachment.html>


Maggiori informazioni sulla lista Python