java 5 could like python?

vegetax vegeta.z at gmail.com
Wed Jan 12 10:36:55 EST 2005


I was a java developer one year ago ,before i moved to python i realy liked 
it at the beggining, but i got very disapointed lately since my 
previus two python proyects where relatively big,and python didnt feel 
well suited for the task.

The reasons are mainly due to the standard library,the language
performance was aceptable, but the library, in my opinion has several grave
issues:

-No naming convention. The speech of "it fits in my head" is no longer valid
when i use a lot of functionality,modules,classes in a large proyect.

For example if i remember a function i want ie:get attribute, i dont
remember if the module implementer coded it as
getAttribute,GetAttribute,get_attribute, then i have to go and check the
doc, every time,which is a waste of time.

-library Organization,we have modules that can have 20 classes(I imagine
that is because of the commodity of having all in one file) which makes
reading the doc horribly painfull and is very hard to find the stuff
coupled with the "pool" of modules that is the python installation
directory,all throwed away at the installation directory without a
categorization.

-Is python library half object oriented? half functional oriented? I can
understand that python allows some functional programing components when
they are necesary,but there are libraries that totaly ignore object
orientation which makes them problematic to use.for example,Whats with the
os.path module and files? why do i have to say os.path.getfilesize(f.name)
all the time? why cant i say f.size? Why does urlparse returns a tuple of 7
items instead of an URL object? why there isnt an URL object? and so on.. 

I havent figured out a way to overcome those factors,the delaying and lost
of focus that is having to check the docs all the time,every 5 seconds and
having to make object oriented wrapers for several libraries or having to
go and read the source code to know what the heck a function returns or
what are its arguments makes coding unpleasant an very slow , i often have
15 pydocs windows open at the same time. What should i do?  

-Realying on ides is imposible due to python dinamic nature,very litle(next
to nothing) assistance can be espected from them.

-Memorazing all the function names,parameters,return values,conventions of
the modules i use doesnt look like a good solution.

Join it with poor and outdated documention and we have a very unpleasant
standard library.

In the other hand, with the recent changes in java 5 i can pythonize
java,And take advantage of a well designed library that coupled with the
"apache commons" libraries has no match,not even .Net.

 for example with the static import feature i can say:

import static mylib.Toolbox.print;
import static mylib.Console.run;
// or import static mylib.Toolbox.*;

class C{
 public void func(){
   print("hello world"); // instead of System.out.println("hello world");
   print(run("ls /tmp"));
 }
}

Same for almost all python builtin functions.

The new for statement :
 
 for (int i : mylist)
   print(i);
 
I guess i could use a cleaver hack to also include the map,filter and other
nice functional components python has.

Also there is the generics support and so on..

But for some reason i dont know,the switch back feels wrong =( ,would it be
posible to imitate python's behavior with the new java features and some
hacks? would be worth the effort? If not what can i do to use efficiently
python modules and libraries? I recall, i didnt had this problem when doing
small applications with a small set of modules.

Sorry for my bad english.





More information about the Python-list mailing list