RE: Java versus Python

Interesting that your example included loop optimization based on typem and not 
any of the protections that this type provides.

Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Q
Sent: Saturday, June 18, 2011 3:54 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Java versus Python

Sina,
Python applications are inherently extensible, see this recipe for a 
trivial-to-implement plugin framework:
http://martyalchin.com/2008/jan/10/simple-plugin-framework/
Admittedly, my experience on large teams is limited. Working on Qwitter 
I've had around 7 other people in total contribute anything 
approximating a significant amount of code. While I've seen people have 
plenty of conceptual issues, trying to use a number in place of a string 
was hardly a prevalent one...
I personally have recently been porting a 10kLoC c++ codebase to python. 
During the experience, the thing which most-often strikes me is the 
amount of code I'm saving. Consider the following snippet:
c++:
double totalFuel = 0;
   foreach(HSSystemInstance*, tankSys, 
mShip->FindSystemsByType(HSST_FUELTANK)) {
     HSFuelTankInstance *tank = static_cast<HSFuelTankInstance*>(tankSys);
     if (tank->GetFuelType() == GetFuelType()) {
       totalFuel += tank->GetCurrentFuel();
     }
   }
   Python:
total_fuel = sum([tank.current_fuel for tank in 
self.ship.find_systems_by_type(systems.FuelTank) if tank.fuel_type == 
self.fuel_type])
While I realize
this departs a bit from the original topic of the thread--the original 
comparison being to Java, I hope this illustrates a bit of the absurdity 
inherent in statically-typed languages without type inference.
On the question of "Does it scale?", let us consider the Django web 
framework, a collaborative effort of over 65,000 lines (and before you 
old-timers comment as to the relative smallness of 65kLoC, consider the 
compression ratio I demonstrated python affords us above.)
Anyway, there's little chance I'll be ending this age-old debate which 
is hardly-unique to the blind community with this message, but I did 
feel it necessary to correct yet more FUD tossed around about what is 
admittedly my favorite high-level language.
      Q

__________
View the list's information and change your settings at 
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
http://www.freelists.org/list/programmingblind

Other related posts: