Is python for me?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dakman@gmail.com

    #16
    Re: Is python for me?

    By large I mean an application with intensive operations, such as a
    fancy GUI maybe a couple of threads, accessing a database, etc.

    lennart wrote:
    dakman@gmail.co m schreef:
    >
    As stated above python is capable of all those things, however on
    larger applications like that it can tend to slow down a bit. And the
    executables do need a little bit of work, because it's bassicly a dll
    and a library of all your .pyc files. However python is still a great
    language and I would recomend it. And most of these things will
    probably be fixed in Python 3000!
    >
    <<snip>>
    Python very quickly.
    >
    Can you define 'large'? Is that large in code, or large in database? I
    don't know which database is supported. If its a external db, like
    MySql, the query is performed through the software of MySql, am I
    right? If I'm correct, the 'slowness' comes from the amount of code in
    python itself, not from the database.

    Comment

    • Tim Chase

      #17
      Re: Is python for me?

      By large I mean an application with intensive operations, such
      as a fancy GUI maybe a couple of threads, accessing a
      database, etc.
      I can't say I've had any python related problems on such matters.
      I've done some modestly large-sized apps, and the bottlenecks
      are almost always I/O bound...disk, network, database (which is
      regularly disk or network bound). Some stuff has done some
      fairly intense computation, and it's usually an algorithmic
      problem, not a python problem (in my case, it was an O(n^2)
      comparison of every element in one list with every element in
      another list to find a "closest" string match to try and gently
      merge two datasets on merely a person's ill-formatted name).

      I'm not sure I'd write a hard-core nuclear-explosion simulator or
      render intense 3d graphics within python. But I'd readily use
      python to glue together low-level optimized versions of libraries
      such as OpenGL where performance counts...

      -tkc




      Comment

      • rodmc

        #18
        Re: Is python for me?

        dakman@gmail.co m wrote:
        By large I mean an application with intensive operations, such as a
        fancy GUI maybe a couple of threads, accessing a database, etc.
        I am still fairly new to Python, I only started using it at the start
        of this year and then stopped for a while. However the project I
        undertook at the start of the year built a system using the
        technologies above, in addition it used SVG graphics, Jabber Instant
        messaging and the windows API. All of these were built within threads
        and used a client/server architecture. I have also built some small
        wxPython based GUI's.

        Overall I found Python ideal for the task, both in terms of development
        time and reliability - although my knowledge of the Windows API was not
        what it should have been (I mainly used Linux/Mac OS X user) so I
        experienced a few problems. Also there was a lack of good online docs
        about Python based Windows API calls.

        You can interface to a few databases very easily including MySQL and
        SQLite. I have been using the latter recently for my task and it works
        very well. Also I have found that using Stackless Python drastically
        improves the reliability of thread based applications. Also performance
        "can" be substantially improved by using the Psyco library, although I
        have know it to make things worse.

        Overall my experience of Python was very positive and this was in no
        small part due to the help I received from people here.

        I hope this helps.

        Best,

        Rod

        Comment

        • Bruno Desthuilliers

          #19
          Re: Is python for me?

          dakman@gmail.co m wrote:
          By large I mean an application with intensive operations, such as a
          fancy GUI maybe a couple of threads, accessing a database, etc.
          >
          Threads are handled by the OS. GUI are (usually) handled by a
          lower-level lib like GTK or such. DB access mostly rely on the
          particular RDBMS. So we're left with the application code itself - the
          glue between all these componants. There's usually nothing really
          "intensive" here, and I wouldn't bet using C++ instead of Python would
          make a huge difference here - wrt/ perceived performances at least.

          My 2 cents...
          --
          bruno desthuilliers
          python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
          p in 'onurb@xiludom. gro'.split('@')])"

          Comment

          • dakman@gmail.com

            #20
            Re: Is python for me?

            Yes of course python can handle of these things, but have you actually
            compared them to something written in C? Even if the app was converted
            into bytecode, it's still not as fast as an executable, that's all I am
            saying.
            Bruno Desthuilliers wrote:
            dakman@gmail.co m wrote:
            By large I mean an application with intensive operations, such as a
            fancy GUI maybe a couple of threads, accessing a database, etc.
            >
            Threads are handled by the OS. GUI are (usually) handled by a
            lower-level lib like GTK or such. DB access mostly rely on the
            particular RDBMS. So we're left with the application code itself - the
            glue between all these componants. There's usually nothing really
            "intensive" here, and I wouldn't bet using C++ instead of Python would
            make a huge difference here - wrt/ perceived performances at least.
            >
            My 2 cents...
            --
            bruno desthuilliers
            python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
            p in 'onurb@xiludom. gro'.split('@')])"

            Comment

            • Magnus Lycka

              #21
              Re: Is python for me?

              I think Python is for you.

              lennart wrote:
              Can you define 'large'? Is that large in code, or large in database? I
              don't know which database is supported. If its a external db, like
              MySql, the query is performed through the software of MySql, am I
              right? If I'm correct, the 'slowness' comes from the amount of code in
              python itself, not from the database.
              I'm afraid dakman's comment wasn't really very helpful.

              Size is not a problem in itself. Ok, if the code modules are very
              large, you will have a larger startup time, but this is probably
              even worse in lower level languages such as C/C++. The python byte
              code works at a higher level of abstraction than machine code, so
              the byte code files are much more compact than corresponding
              executable binaries from e.g. C/C++/Delphi.

              The Python programming language, with its classes, modules,
              packages etc is in my experience much better for writing large
              applications without causing a mess than e.g. C++. It's much
              easier to make a mess with C/C++'s "#include" than with Python's
              "import". The lack of static typing means that some problems that
              the compiler/linker would find in e.g. C++ development won't turn
              up until you test your code in Python, but you'll get to testing
              much faster with Python, and if you don't test well, you'll fail
              with any larger development project however clever your compiler
              and linker is.

              Due to Python's very dynamic nature, there are a lot of operations
              that will be much slower than in e.g. C or C++. For instance, if
              you write "a = b + c" in C, the compiler knows at compile time what
              types a, b and c are, and if they for example are ints, the addition
              will be translated into a few very simple and quick machine code
              instructions. In Python, the types typically won't be know until
              runtime. This means that the objects need to be inspected during
              execution to figure out what + means for these kinds of objects.
              Python also handles memory allocation etc.

              The consequence of this is that some kinds of programs that do
              millions of trivial things, such as cryptography applications
              where there are a lot of repeated multiplications and additions,
              would be much, much slower in pure Python than in pure C. This
              doesn't mean that Python is bad for a large group of applications.
              It means that for a large group of applications, there are some
              parts (for instance computationally intensive or e.g. interfacing
              with some kind of devices or third party products) that should be
              handled by extensions written in e.g. C.

              Whatever you plan to do, it's likely that the extensions you need
              already exists. There are such extensions for databases, networking,
              maths, cryptography, XML parsing, etc etc. I'm a programmer working
              with C, C++, Python, SQL etc, and despite 10 years of Python coding
              I never actually needed to code any C extension myself yet. It's
              very likely that you'll get away using 100% pure Python too. Note
              that large parts of your programs will be C code, but C code you
              didn't have to write yourself, and as far as your programming is
              concerned it could as well have been Python, it's just that things
              will run faster than if it had been pure Python...

              Have fun!

              Comment

              • Danny Milosavljevic

                #22
                Re: Is python for me?

                Hi,

                On Thu, 16 Nov 2006 10:22:57 -0800, "dakman wrote:
                Yes of course python can handle of these things, but have you actually
                compared them to something written in C? Even if the app was converted
                into bytecode, it's still not as fast as an executable, that's all I am
                saying.
                I used to routinely write gui programs (data entry and such) in python
                first and then ported them down to C for speed. I stopped the downporting,
                isn't worth it, I just stay in python.

                Make no mistake, python itself is slow enough. Its just that with today's
                CPUs, no, even with CPUs 3 years old (mine is an Athlon XP), most
                of the time slow is still faster than needed.

                Once you start to do heavy-lifting in python, the picture becomes bleak,
                though (I tried to write a Truetype Font Repacker
                http://www.scratchpost.org/hacks/tru...font-repacker/ without using any
                external font libraries and its dog slow).

                That said, most programming (for me also at work) consists of glue code.

                And there still is that python to C++ converter, what was it called?
                And python for dotnet. And Jython.
                Those should help with speed a bit.

                cheers,
                Danny

                Comment

                • cyberco

                  #23
                  Re: Is python for me?

                  One resource you should always keep at hand is this extremely useful
                  Quick Reference:

                  Python 2.4 language Quick Reference, freely available in HTML (several styles) and PDF versions.


                  Study it carefully, there is a lot in there that can teach you about
                  how Python works. Fire up IPython as well and start hacking!

                  2B

                  Comment

                  Working...