pain

Discussion in 'Python' started by Mage, Aug 3, 2005.

  1. Mage

    Mage Guest

    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
    Mage, Aug 3, 2005
    #1
    1. Advertising

  2. 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
    Michael Hoffman, Aug 3, 2005
    #2
    1. Advertising

  3. Mage

    Mandus Guest

    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.
    Mandus, Aug 3, 2005
    #3
  4. Mage

    Mage Guest

    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
    Mage, Aug 3, 2005
    #4
  5. Mage

    Mage Guest

    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
    Mage, Aug 3, 2005
    #5
  6. On 2005-08-03, Mage <> 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!!
    Grant Edwards, Aug 3, 2005
    #6
  7. Mage

    Terry Reedy Guest

    "Mage" <> wrote in message news:...
    > 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
    Terry Reedy, Aug 3, 2005
    #7
  8. Mage

    Mage Guest

    Terry Reedy wrote:

    >"Mage" <> wrote in message news:...
    >
    >
    >>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
    Mage, Aug 3, 2005
    #8
  9. 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?
    Martin P. Hellwig, Aug 4, 2005
    #9
  10. 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
    Greg Lindstrom, Aug 4, 2005
    #10
  11. Mage

    projecktzero Guest

    "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".
    projecktzero, Aug 4, 2005
    #11
  12. Mage

    Mike Meyer Guest

    Grant Edwards <> writes:

    > On 2005-08-03, Mage <> 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 <> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
    Mike Meyer, Aug 5, 2005
    #12
  13. Mage

    Kent Johnson Guest

    Mike Meyer wrote:
    > Grant Edwards <> writes:
    >
    >
    >>On 2005-08-03, Mage <> 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
    Kent Johnson, Aug 5, 2005
    #13
  14. Mage

    Mike Meyer Guest

    Kent Johnson <> 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 <> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
    Mike Meyer, Aug 6, 2005
    #14
  15. Mage

    James Stroud Guest

    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/
    James Stroud, Sep 2, 2005
    #15
  16. Mage

    Steve Holden Guest

    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/
    Steve Holden, Sep 2, 2005
    #16
  17. Mage

    Peter Hansen Guest

    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
    Peter Hansen, Sep 2, 2005
    #17
  18. Mage

    Steve Holden Guest

    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/
    Steve Holden, Sep 2, 2005
    #18
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Olaf Petzold
    Replies:
    12
    Views:
    7,388
    Rob Dekker
    Dec 23, 2005
  2. =?Utf-8?B?S1JN?=

    DropDownList Pain

    =?Utf-8?B?S1JN?=, May 25, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    374
    =?Utf-8?B?S1JN?=
    May 25, 2005
  3. Daniel Manes

    Code-Behind Pain in the Behind!

    Daniel Manes, Jun 10, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    644
  4. Brent White

    Sorry to be such a pain

    Brent White, Oct 24, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    533
    Juan T. Llibre
    Oct 25, 2005
  5. =?Utf-8?B?TWlrZUppbmdKaW5n?=

    HELP Access DB, ASP.NET 2.0 and whole lot of pain

    =?Utf-8?B?TWlrZUppbmdKaW5n?=, Dec 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    465
    Patrice
    Dec 6, 2005
Loading...

Share This Page