473,385 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

pain

Hello,

I started to learn python some months ago. Mostly for fun, but I
replaced php to python in many tools at my company in the last weeks.

Because of our boss decision now I have to learn java. I can tell java
is one of the worst things including WW2. Even after seeing the light I
may vomit when I write java code.

Look at this tutorial from java.com:

public class BasicsDemo {
public static void main(String[] args) {
int sum = 0;
for (int current = 1; current <= 10; current++) {
sum += current;
}
System.out.println("Sum = " + sum);
}
}

It is "print sum(range(11))" in python.

I just had to tell this, sorry for the bandwith. I suggest you to feel
lucky if you may use python at your work.

Mage
Aug 3 '05 #1
17 1355
Mage wrote:
Look at this tutorial from java.com:

public class BasicsDemo {
public static void main(String[] args) {
int sum = 0;
for (int current = 1; current <= 10; current++) {
sum += current;
}
System.out.println("Sum = " + sum);
}
}
And then you have to compile it and set up your classpath...
It is "print sum(range(11))" in python.
I would have used print sum(xrange(11)) myself. This probably has almost
zero measurable performance impact, but I think using xrange() instead
of range() is usually a good habit. As you know, xrange() generates ints
as it is called rather than all at once, which can be quite helpful with
large ranges.
I suggest you to feel lucky if you may use python at your work.


Every day.
--
Michael Hoffman
Aug 3 '05 #2
Wed, 03 Aug 2005 17:45:34 +0200 skrev Mage:
Hello,

I started to learn python some months ago. Mostly for fun, but I
replaced php to python in many tools at my company in the last weeks.

Because of our boss decision now I have to learn java. I can tell java

[snip]

maybe you can use jython, and tell your boss it's Java. A boss forcing
people to learn and use Java probably have no interest at all ever read
the code himself, so you will probably get away with it. I mean, a
clueless boss...

or just find another place to work?

Don't code Java, be happy :-)

mvh,
--
Mandus - the only mandus around.
Aug 3 '05 #3
Mandus wrote:
Wed, 03 Aug 2005 17:45:34 +0200 skrev Mage:

Hello,

I started to learn python some months ago. Mostly for fun, but I
replaced php to python in many tools at my company in the last weeks.

Because of our boss decision now I have to learn java. I can tell java

[snip]

maybe you can use jython, and tell your boss it's Java. A boss forcing
people to learn and use Java probably have no interest at all ever read
the code himself, so you will probably get away with it. I mean, a
clueless boss...

Thank you, I will check this out. My company will switch to a jsp site.
Isn't jython slower (I mean performance) than java? As well as I
understand jython code will be interpreted twice.
or just find another place to work?

Acceptable but I have some reasons to stay.
Don't code Java, be happy :-)

I would be surprised if there were more than five python jobs in my
country but have to look around.

Mage

Aug 3 '05 #4
Michael Hoffman wrote:

I would have used print sum(xrange(11)) myself.

This is why I love python and this list.
I can't be as offtopic that you wouldn't be able to say something useful
to me about python. Thank you.

Mage
Aug 3 '05 #5
On 2005-08-03, Mage <ma**@mage.hu> wrote:
Isn't jython slower (I mean performance) than java? As well as
I understand jython code will be interpreted twice.


Jython gets compiled into Java byte code just like Java gets
compiled into Java byte code. Then whatever platform you're
using either interprets the Java byte code or uses some variant
of JIT compilation into native object code.

--
Grant Edwards grante Yow! HELLO, little boys!
at Gimme a MINT TULIP!! Let's
visi.com do the BOSSA NOVA!!
Aug 3 '05 #6

"Mage" <ma**@mage.hu> wrote in message news:42**************@mage.hu...
Thank you, I will check this out. My company will switch to a jsp site.
Isn't jython slower (I mean performance) than java? As well as I
understand jython code will be interpreted twice.


I believe only in the sense that Java is interpreted twice: once to compile
to Java bytecode and again, as often as you want, to run the bytecode
(assuming that it is kept around, just as .pyc files are).

tjr

Aug 3 '05 #7
Terry Reedy wrote:
"Mage" <ma**@mage.hu> wrote in message news:42**************@mage.hu...

Thank you, I will check this out. My company will switch to a jsp site.
Isn't jython slower (I mean performance) than java? As well as I
understand jython code will be interpreted twice.


I believe only in the sense that Java is interpreted twice: once to compile
to Java bytecode and again, as often as you want, to run the bytecode
(assuming that it is kept around, just as .pyc files are).

Thank you, I will read it thoroughly instead of just fast-reading the
mainpage as last time :)

Mage
Aug 3 '05 #8
Mage wrote:
<cut>

Thank you, I will check this out. My company will switch to a jsp site.

<cut>
Well I don't know your company and how many developers there are but I
know this; a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who best
know what tools to use are the peope who use the tools*. If by any
chance a manager believes that his employees aren't qualified to make
that decision for them self then he hired the wrong people, which makes
him bad manager too.

But perhaps there are other compelling reasons to switch to a jsp site,
but since this is webbased, there are *tons* of ways to mix your
favourite language with it, even as abstracted as having a jsp (proxy)
page do nothing more then fetch its page from a python powered internal
webserver.

--
mph
* Did you know that most good chef cooks have their own knive set?
And what do you think is the reason a restaurant manager don't tell them
to use the company in-house Amefa blades instead of his global knives?
Aug 4 '05 #9
Mage Wrote:
I would be surprised if there were more than five python jobs in my
country but have to look around.

I Reply:
It's not quite that bad in Arkansas (USA), but when I was hired to help
start a new IT department I insisted on using Python and my employer
agreed to try it. I now have over 15,000 lines of code running in
production and the CEO of the company says he has "six or seven" more
projects for me to write (with huge cost saving potential for the
company). We're running on GenToo Linux using a Postgres database and
PHP for our web development. We've automated about 25% of our day to
day business and are looking to expand! I've never had more fun
writing code, and I've been writing code for over 20 years.

Would it be possible to talk to your supervisor and convince them to
allow you to use Python? Start small, with a little project. When you
show them that Python "works" and that they will be able to understand
the code, I'm guessing they will let you do more. Before you know it,
you're coding everything in Python.

Best of luck,
--greg

Aug 4 '05 #10
"a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who
best
know what tools to use are the peope who use the tools*."

I'm sorry, this doesn't make much sense to me. In an ideal world where
all developers are all knowing and know every language inside and out,
then allowing each developer to choose his tools(languages) would work.
You don't see a problem with programmer Joe using Perl, Brad using
Python, Carl uses Smalltalk, Nate uses Java, Steve using Ruby, and Ed
using Haskell?

"* Did you know that most good chef cooks have their own knive set?
And what do you think is the reason a restaurant manager don't tell
them
to use the company in-house Amefa blades instead of his global knives?
"

This is a very poor analogy. The next chef doesn't have to re-cook what
the previous chef has done(well, that didn't work either)...er...This
has nothing to do with programming.

The manager may have his reasons for choosing the tools. Perhaps nearly
all projects that have been developed and are in development are using
paticular tools. It's easy for team members to work on any project.(I'm
speaking more of languages and frameworks not down to the editors and
IDEs.) It would be nice if the team could decide on tools, and
sometimes that's appropriate. Maybe they want to migrate to a new
language or framework. Maybe there's a throw away project that could be
a test for the new language or framework. If you want to try a
new/different language, you need to show the benefit other than "it's
cool/new".

Aug 4 '05 #11
Grant Edwards <gr****@visi.com> writes:
On 2005-08-03, Mage <ma**@mage.hu> wrote:
Isn't jython slower (I mean performance) than java? As well as
I understand jython code will be interpreted twice.


Jython gets compiled into Java byte code just like Java gets
compiled into Java byte code. Then whatever platform you're
using either interprets the Java byte code or uses some variant
of JIT compilation into native object code.


The compiled jython will pay a performance penalty for being
dynamic. Where Java knows the type of objects, and can deduce the
correct method to call at compile time (well, some of the time,
anyway), the jython code will have to do a method search at run time.

Chance are, if you're supposed to be wwriting in Java, your
application isn't sensitive enough to the performance of the code for
this to matter.

<mike

--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Aug 5 '05 #12
Mike Meyer wrote:
Grant Edwards <gr****@visi.com> writes:

On 2005-08-03, Mage <ma**@mage.hu> wrote:

Isn't jython slower (I mean performance) than java? As well as
I understand jython code will be interpreted twice.


The compiled jython will pay a performance penalty for being
dynamic. Where Java knows the type of objects, and can deduce the
correct method to call at compile time (well, some of the time,
anyway), the jython code will have to do a method search at run time.


Yes, the compiled code makes heavy use of the Jython runtime to get anything done.

*But* most of the hard work will probably be done by Java code in libraries you call. For example a Swing UI, XML parsing, database calls, etc all will happen in Java code. So in practice the performance penalty is not significant and is more than offset by the productivity benefit.

Kent
Aug 5 '05 #13
Kent Johnson <ke****@tds.net> writes:
Mike Meyer wrote:
The compiled jython will pay a performance penalty for being
dynamic. Where Java knows the type of objects, and can deduce the
correct method to call at compile time (well, some of the time,
anyway), the jython code will have to do a method search at run time.


Yes, the compiled code makes heavy use of the Jython runtime to get anything done.

*But* most of the hard work will probably be done by Java code in
libraries you call. For example a Swing UI, XML parsing, database
calls, etc all will happen in Java code.


One would hope so. That's how you get good performance out of CPython
apps - you arrange for the heavy lifting to be done by libraries
written in C.

<mike
--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Aug 6 '05 #14

On Thursday 04 August 2005 07:49 am, projecktzero wrote:
"a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who
best
know what tools to use are the peope who use the tools*."

I'm sorry, this doesn't make much sense to me. In an ideal world where
all developers are all knowing and know every language inside and out,
then allowing each developer to choose his tools(languages) would work.
You don't see a problem with programmer Joe using Perl, Brad using
Python, Carl uses Smalltalk, Nate uses Java, Steve using Ruby, and Ed
using Haskell?
A library could be written in python and interfaced in java for others to use
who are too lazy to know both.
"* Did you know that most good chef cooks have their own knive set?
And what do you think is the reason a restaurant manager don't tell
them
to use the company in-house Amefa blades instead of his global knives?
"

This is a very poor analogy. The next chef doesn't have to re-cook what
the previous chef has done(well, that didn't work either)...er...This
has nothing to do with programming.

The manager may have his reasons for choosing the tools.
Reason: ignorance.
Perhaps nearly
all projects that have been developed and are in development are using
paticular tools. It's easy for team members to work on any project.(I'm
speaking more of languages and frameworks not down to the editors and
IDEs.) It would be nice if the team could decide on tools, and
sometimes that's appropriate. Maybe they want to migrate to a new
language or framework. Maybe there's a throw away project that could be
a test for the new language or framework. If you want to try a
new/different language, you need to show the benefit other than "it's
cool/new".


A manager insisting on java is probably only thinking about name recognition
anyway. Hey Mr. Client, were using java. Isn't that "cool"?

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Sep 2 '05 #15
James Stroud wrote:
On Thursday 04 August 2005 07:49 am, projecktzero wrote:

[...]
The manager may have his reasons for choosing the tools.

Reason: ignorance.

[...]

and the day managers stop being ignorant we'll all be able to fly around
on pigs. Not wishing to offend the pigs, of course.

still-working-for-myself-ly y'rs - steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 2 '05 #16
Steve Holden wrote:
and the day managers stop being ignorant we'll all be able to fly around
on pigs. Not wishing to offend the pigs, of course.

still-working-for-myself-ly y'rs - steve


What Steve means here, of course, is that he is his own manager.

;-)

-Peter
Sep 2 '05 #17
Peter Hansen wrote:
Steve Holden wrote:
and the day managers stop being ignorant we'll all be able to fly around
on pigs. Not wishing to offend the pigs, of course.

still-working-for-myself-ly y'rs - steve

What Steve means here, of course, is that he is his own manager.

;-)

Right. This means I get to make fun of my own pointy hair.

at-least-as-long-as-i-still-have-hair-ly y'rs -steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 5 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christine McGavran | last post by:
To continue a previous thread, sort of... I have defined a schema for describing a windows-style user interface. My application correctly parses and uses that schema. I'm now trying to get that...
4
by: Bob | last post by:
I found it a real pain working with the datasets and table adapters and bound records. Here's why. During development I find I occasionally have to change some part of a table definition. Say I...
1
by: YesGoGoGo | last post by:
hello! I use asp+vb before and new to ASP.NET. And I have to write a new function with C# I draw a prototype and the picture is here--- http://0rz.net/af1hy let me explain this process in detail...
0
by: Paul | last post by:
Cures for Cancer–AIDS–Chronic Fatigue–Chronic Pain–Diabetes… …and the list could go on. There is a Medical/Pharmaceutical Cartel in America that is more evil than the Arms Dealers and...
6
by: JohnQ | last post by:
I like, non-copyable, non-assignable and, most often, non-default-constructable also, as a starting point for class design: class SomeClass { SomeClass(); // disallow default construction...
7
by: Beorn | last post by:
Consider this example: ... for i in range(5): ... def g(): return x + i ... yield g I would expect the value of x used in g to be that at the function declaration time,...
0
by: westbcristeeufk | last post by:
detoxifying pain relief patch http://cracks.00bp.com F R E E
0
by: fogleman44523 | last post by:
lidocaine patch chronic pain http://cracks.12w.net F R E E
0
by: dudeja.rajat | last post by:
Hi, I'm using a TkMessageBox for handling some errors and displaying them through the message boxes. My code is as below: if selectedVer == strNoArchivedResults: tkMessageBox._show("Error",...
0
by: Guilherme Polo | last post by:
On Mon, Sep 1, 2008 at 3:35 PM, <dudeja.rajat@gmail.comwrote: Note that you are not supposed to use _show, use showerror here instead. Remove the call to sys.exit then ? Your ask for a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.