Python 'Lets Me See The Forest'

Discussion in 'Python' started by Kamilche, Jun 4, 2004.

  1. Kamilche

    Kamilche Guest

    Man, I've been banging my head against a C program for a while now.
    I'm embarrassed to admit how long. I really want to use Python, as I
    mentioned in a prior post, but the speed hit is such that I'll
    probably use it only for prototyping.

    But boy, development sure is fast in Python! Today, while playing with
    it, I thought of a better way to arrange my data, that makes the
    program more flexible. It's a good enough idea to warrant redoing my
    code (even my C code) to take advantage of it. When I went to write up
    the pseudocode to process the new method, I found myself naturally
    using Python.

    C is just so... detail oriented. By the time I set up the data
    structures, do the string manipulation and memory management, I can
    hardly remember what it was I was initially trying to accomplish, much
    less think of a better way to do it! Maybe I'm just getting old... but
    Python just fits my idea of 'mental pseudocode' so well, it's hard to
    resist using it. Dictionaries ARE an underutilized concept in DP, and
    I was using them up the yin yang, even in my C program. Python meshes
    well with my programming style.

    --Kamilche
     
    Kamilche, Jun 4, 2004
    #1
    1. Advertising

  2. Kamilche

    Larry Bates Guest

    I have a theory that the more experienced a programmer
    is (e.g. has used a number of "hard" languages for
    many years) the more they will like and be able to
    use the power of Python. I've been programming for
    over 30 years and I LOVE Python. I committed to doing
    all my coding in Python about 2 years ago and have
    never regretted it. I find that I'm still turning
    up "jewels" of programming methodology every day.

    The power of any good programming language is the
    ability to "hide" complexity without limiting
    flexibility. Python does an excellent job of this.
    I wouldn't have any problem starting beginning
    programmers with Python (it's much better than VB
    for the pure beginner). The beauty is that unlike
    many "beginner" languages it never seems to run
    out of power. You can write incredibly complex
    programs in Python that run well and are a joy to
    maintain. Python is pseudo-code that actually
    runs without being translated into some other
    language!

    The other thing I like is that it runs everywhere.
    I've written Windows NT services, Windows NT COM+
    objects, regular text mode programs, Windows GUI
    programs (with wxWindows), Linux programs, dynamic
    webpage programs, etc. Without Python I would have
    to switch between 3-4 languages and would never get
    really proficient with any of them.

    The reusability of modules means that I can use
    modules that I've written for one project and easily
    use them for other projects. I start out with
    thousands of lines of mature, debugged code in these
    modules that gives me a real running start at the
    project at hand. Now I know that this ability is
    not unique to Python, it just seems that it gets
    used more than in most other languages.

    Glad you hare having fun.
    Larry Bates
    Syscon, Inc.


    "Kamilche" <> wrote in message
    news:...
    > Man, I've been banging my head against a C program for a while now.
    > I'm embarrassed to admit how long. I really want to use Python, as I
    > mentioned in a prior post, but the speed hit is such that I'll
    > probably use it only for prototyping.
    >
    > But boy, development sure is fast in Python! Today, while playing with
    > it, I thought of a better way to arrange my data, that makes the
    > program more flexible. It's a good enough idea to warrant redoing my
    > code (even my C code) to take advantage of it. When I went to write up
    > the pseudocode to process the new method, I found myself naturally
    > using Python.
    >
    > C is just so... detail oriented. By the time I set up the data
    > structures, do the string manipulation and memory management, I can
    > hardly remember what it was I was initially trying to accomplish, much
    > less think of a better way to do it! Maybe I'm just getting old... but
    > Python just fits my idea of 'mental pseudocode' so well, it's hard to
    > resist using it. Dictionaries ARE an underutilized concept in DP, and
    > I was using them up the yin yang, even in my C program. Python meshes
    > well with my programming style.
    >
    > --Kamilche
     
    Larry Bates, Jun 4, 2004
    #2
    1. Advertising

  3. Kamilche

    Guest

    (Kamilche) wrote:
    >Man, I've been banging my head against a C program for a while now.
    >I'm embarrassed to admit how long. I really want to use Python, as I
    >mentioned in a prior post, but the speed hit is such that I'll
    >probably use it only for prototyping.
    >
    >But boy, development sure is fast in Python! Today, while playing with
    >it, I thought of a better way to arrange my data, that makes the
    >program more flexible. It's a good enough idea to warrant redoing my
    >code (even my C code) to take advantage of it. When I went to write up
    >the pseudocode to process the new method, I found myself naturally
    >using Python.
    >
    >C is just so... detail oriented. By the time I set up the data
    >structures, do the string manipulation and memory management, I can
    >hardly remember what it was I was initially trying to accomplish, much
    >less think of a better way to do it! Maybe I'm just getting old... but
    >Python just fits my idea of 'mental pseudocode' so well, it's hard to
    >resist using it. Dictionaries ARE an underutilized concept in DP, and
    >I was using them up the yin yang, even in my C program. Python meshes
    >well with my programming style.
    >
    >--Kamilche


    I am no C++ expert, to put it mildly, but couldn't some of your problems
    have been solved by using C++ instead of C? C++ has data structures like
    vectors, lists, and maps, with many algorithms in the STL to work with them.
    Using references to pass arguments, one can avoid low-level pointers in many
    cases. C++ strings are easier to use the C char's. There are templated classes
    to replicate some of the functionality of Python's Numeric/Numarray or Fortran
    90/95 arrays. C is more of a low-level systems language than an application
    programming language -- comparing it to Python seems unfair to me, when the
    choice of C++ exists.

    For strictly numerical tasks Fortran 95 is in my experience both more readable
    than Python (because of variable declarations and the ability to define constants)
    AND much faster. You do not have to suffer Python's performance hit to program
    in a clean, high-level language.

    (I like Python, but there is so much pro-Python propaganda in this newsgroup
    that some anti-Python messages may be a healthy corrective.)



    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    , Jun 4, 2004
    #3
  4. Kamilche

    Kamilche Guest

    "" <beliavsky@127.0.0.1:7501> wrote in message news:<40c0b153$1_1@127.0.0.1>...

    > I am no C++ expert, to put it mildly, but couldn't some of your problems
    > have been solved by using C++ instead of C?


    Uh. Yeah. I know C++ sort of, I redid all my base code in preparation
    for using it... and it decidedly DIDN'T mesh with my programming
    style! :-O I gave it up after finding one too many complexities and
    oddities in the language.

    I've used quite a few languages... C, C++, Fortran, Pascal, Assembler,
    COBOL, Basic, Visual Basic (6), Python, Javascript, and Hypercard. The
    ones I used most heavily were COBOL, HyperCard, Visual Basic, and C.
    The top 4 faves were VB, Python, HyperCard, and C, in that order.
    HyperCard is dead now, but it had its day. Of the remaining 3, I'm
    mainly using Python and C, since MS killed VB6. They all had their
    glories. Note the marked lack of C++ in the top 4. :-D You have to be
    superhuman, or maybe just supertwisted, to be productive in that
    language. :-O

    --Kamilche
     
    Kamilche, Jun 5, 2004
    #4
  5. Kamilche

    Kamilche Guest

    "Larry Bates" <> wrote in message news:<>...

    > ... I've been programming for
    > over 30 years and I LOVE Python. I committed to doing
    > all my coding in Python about 2 years ago and have
    > never regretted it. I find that I'm still turning
    > up "jewels" of programming methodology every day.


    Wow, you must be quite skilled in the intricacies of Python, then. Do
    you have a web page where you share pearls of Python wisdom? From my
    Google searches, it appears pages like that are still very necessary
    in this language. :)

    I wish I had a better book on it, or the online reference was more
    comprehensive.

    --Kamilche
     
    Kamilche, Jun 5, 2004
    #5
  6. Kamilche

    David Bolen Guest

    "" <beliavsky@127.0.0.1:7501> writes:

    > I am no C++ expert, to put it mildly, but couldn't some of your
    > problems have been solved by using C++ instead of C? C++ has data
    > structures like vectors, lists, and maps, with many algorithms in
    > the STL to work with them. Using references to pass arguments, one
    > can avoid low-level pointers in many cases. C++ strings are easier
    > to use the C char's. There are templated classes to replicate some
    > of the functionality of Python's Numeric/Numarray or Fortran 90/95
    > arrays. C is more of a low-level systems language than an
    > application programming language -- comparing it to Python seems
    > unfair to me, when the choice of C++ exists.


    I don't know if it's just me, but a funny thing I've found is that
    after using Python almost extensively for the past 4-5 years, I find
    it much easier to grasp and appreciate the C++ STL than I did prior to
    Python. Of course, to be fair back before Python when I was using C++
    more significantly, I hadn't really been out of the C world for too
    long, and I recall compiler template support being more hit and miss
    so trusting the STL (if it was even available) was tricky, but I think
    Python helped get my mindset more acclimated to the higher level data
    constructs, making it more natural to use their C++ counterparts when
    working nowadays with C++, things which I tended not to utilize as
    effectively in the past.

    With that said, doing similar work in C++ versus Python even today
    feels like I'm working in a tar pit while working on the C++ side.
    Oh, I like the performance and part of me still can't help but enjoy
    the feeling of working closer to the metal, but egads, the extra
    typing (particularly with the STL), the fighting with the compiler's
    type checking, those horrible template error messages. Heck, basic
    iteration, or even the hoops to jump through to bind instance members
    for callbacks. The STL is a valuable set of generic containers and
    algorithms that I wouldn't want to do without in C++, but similiar to
    the original poster's point, I still feel burdened down with details
    when working with them compared to equivalent Python code, even when
    the code is algorithmically and data structurally similar.

    Of course, the end performance advantage of the C++ version over the
    Python version makes up for that in some specific cases, but not
    enough for me to ever want to go back to C++ as a language of first
    choice for most of my target development, even with the STL, strings
    and other templated classes.

    -- David
     
    David Bolen, Jun 7, 2004
    #6
  7. Kamilche

    j_mckitrick Guest

    David Bolen <> wrote in message
    > Of course, the end performance advantage of the C++ version over the
    > Python version makes up for that in some specific cases, but not
    > enough for me to ever want to go back to C++ as a language of first
    > choice for most of my target development, even with the STL, strings
    > and other templated classes.


    I agree. I've been working on an app in Python, next to a rather
    large commercial app in MS C++. The error messages I get back from
    VC++ are like a maze of tokens and expressions. The Python errors I
    get are succinct and to the point. I've been deciphering VC STL
    messages for some time now, but they don't really get much easier.
    Python makes it downright simple.

    jonathon
     
    j_mckitrick, Jun 8, 2004
    #7
  8. > >--Kamilche
    >
    > I am no C++ expert, to put it mildly, but couldn't some of your problems
    > have been solved by using C++ instead of C? C++ has data structures like
    > vectors, lists, and maps, with many algorithms in the STL to work with them.
    > Using references to pass arguments, one can avoid low-level pointers in many
    > cases. C++ strings are easier to use the C char's. There are templated classes
    > to replicate some of the functionality of Python's Numeric/Numarray or Fortran
    > 90/95 arrays. C is more of a low-level systems language than an application
    > programming language -- comparing it to Python seems unfair to me, when the
    > choice of C++ exists.
    >


    Heresy, but - often I find C++ a more natural way to express
    algorithms than Python. In particular iterators (OK, being blunt -
    pointers) are often a great way to break down complexity.

    Unfortunately, the amount of junk you have to deal with to get there
    is just not worth it.

    > For strictly numerical tasks Fortran 95 is in my experience both more readable
    > than Python (because of variable declarations and the ability to define constants)
    > AND much faster. You do not have to suffer Python's performance hit to program
    > in a clean, high-level language.
    >
    > (I like Python, but there is so much pro-Python propaganda in this newsgroup
    > that some anti-Python messages may be a healthy corrective.)
    >


    I keep hearing great things about F95; I'll have to try it out.

    >
    >
    > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    > http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    > ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    James Moughan, Jun 8, 2004
    #8
    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. xyZed
    Replies:
    3
    Views:
    1,375
    Jacqui or (maybe) Pete
    Jun 29, 2003
  2. News
    Replies:
    5
    Views:
    567
    Dennis Lee Bieber
    Apr 14, 2006
  3. Ron
    Replies:
    2
    Views:
    142
    Randy Rahbar
    Sep 29, 2003
  4. bpatton
    Replies:
    4
    Views:
    130
    Uri Guttman
    Aug 24, 2006
  5. Replies:
    2
    Views:
    128
Loading...

Share This Page