Program in or into (was Python handles globals badly)

random832 at fastmail.us random832 at fastmail.us
Sun Sep 6 01:26:43 EDT 2015


Steven D'Aprano <steve at pearwood.info> writes:

> That depends. Is the example C# code idiomatic for the language?

Not in the least. My first clue was Int32 - nobody actually uses those
names.

> Or was it
> written by somebody ignorant of C#, and consequently is a poor example of
> badly-written and unidiomatic "Java in C#"?
>
> If the first, then I expect I would write the C# code, because it is
> idiomatic and works. What would you do?
>
> It is certainly true that C# appears to be a more verbose language than
> Python. Based on this example, it prefers to use classes with methods
> rather than stand-alone functions,

You certainly need to put methods in a class, but it's absurd that they
made it an actual instantiable class with instance properties for the
variables they required for sorting, rather than there being a class
that's just there as a container for the functions. I wouldn't do that
in Java, either.

They also gave it features a lot of the shorter versions on the page
don't have; the ability to fall back to insertion sort for short lists,
and the ability to tune exactly how it does that, and how many
subsequences to sort and merge.



More information about the Python-list mailing list