Program in or into (was Python handles globals badly)

Rustom Mody rustompmody at gmail.com
Sun Sep 6 00:35:30 EDT 2015


On Sunday, September 6, 2015 at 8:05:28 AM UTC+5:30, Steven D'Aprano wrote:
> On Sat, 5 Sep 2015 01:18 pm, Rustom Mody wrote:
> 
> > Here's mergesort written in various languages
> > http://rosettacode.org/wiki/Sorting_algorithms/Merge_sort
> > 
> > You could look at the java if you like but I think C# takes the cake.
> > And of course also there's the python
> > 
> > Now the thought experiment:
> > 
> > For some reason you need to code in C#
> > [You need to do this part of the experiment honestly!!]
> > 
> > Would you write the C# code?
> > Or would you write the python-ish code in C# ?
> 
> 
> That depends. Is the example C# code idiomatic for the language? 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?

I'd cringe
And suspect malefide intent on the part of those who wrote that code to show
C# in bad light :-)

Thats partly joke because the java looks somewhat better and C# and Java are
not very different

My main point of course was that between the two extremes:
1. What the language mandates eg python mandates a ':' after the if condition
C mandates that it be parenthesized
2. Matters of free personal taste

there is a large in-between grey area where the language's 'keepers' 
recommend best (and not) practices which may not exactly be the best for a
programmer.

eg Consider perl and python.
As for regex support they are mostly the same
Yet a typical pythonista takes pride that he wrote a 10 line re-free function
where a 2-line re would have sufficed
A typical perl guy will take pleasure in exactly the opposite achievement

A programmer wanting to get his job done need not believe any of these fads&fancies



More information about the Python-list mailing list