|
Re: I think I am Python Challenged
|
Posted: Jun 10, 2005 11:18 AM
|
|
> > So, please, enlighten me. > > I think this is impossible for systemic reasons: you have > to enlighten yourself :)
I'm listening/reading, but not sure I'm getting what I need yet.
> What is expressable in Python, that is not in Java? Try to > find an interactive console where you can run Java code > snippets.
Very seldom do I need to do this. Practically, I don't get stuck on things that require small snippets of code to try out. I have used very expressive languages at times, which have consoles, and it is there odd, variable syntax and expressivity that made it necessary to use a console to make it easier to try and find the right expression! The limited expressivity in Java feels empowering to me, less to remember.
The fact that there is not a widely used console for Java, to me, just says that its not needed by the masses. There are some interactive Java environments that do use Java's dynamic classloading and introspective capabilities to let you have a command line. However, the more strict object structure of Java makes it difficult to have an enclosing object that the lines of code you type can be encapsulated within. However, it is technically possible to make something that works, and I've used at least one Java console that did work. It was just not something that I needed to use on a regular basis.
> I consider Python as an interactive OO language > much like I consider LISP as an interactive FP language. > This influences my programming style in Python because I > always try to define objects, that have an intuitive > appeal, that behave on a console like numbers, lists, > dicts or other simple stuff. Therefore a user that deals > with objects in a naive way is always somehow integrated > in the program itself.
I use Java collection objects a lot too. I tend to use maps in many cases that others might use lists initially, because I've found that many times I need a map, later in the evolution of the application, and I can thus more easily alter the map use then swithing from list to map. Also, fast access in a list requires the extra index item. In a map, you can use the object, or some existing item in the object that the map stores.
> Another related issue: each Python > module can be the __main__ entry point of the interpreter. > Each module has two sides: one as a standalone program and > the other as a part of a more complex system which is > again focussed in a module, which is part... This is why I > indeed believe that Python is a language enabled for > building large systems and I expect more of them on the > market in future.
I can understand the convenience of using the object this way. Technically, Java's use of
public static void main( String args[] );
as the main entry point is only an implementation detail of the java interpreter that Sun and others provide with their JVM. There is nothing that keeps one from creating a different launcher to provide similar capabilities to what you describe above. The JNI mechanisms let you do this, and I've used JNI to launch a Java application as a Windows Service using a different launch interface than the typical one.
|
|