473,320 Members | 2,088 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,320 software developers and data experts.

Python 'Lets Me See The Forest'

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
Jul 18 '05 #1
7 1343
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" <kl*******@home.com> wrote in message
news:88**************************@posting.google.c om...
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

Jul 18 '05 #2

kl*******@home.com (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 =---
Jul 18 '05 #3
"be*******@aol.com" <be*******@127.0.0.1:7501> wrote in message news:<40**********@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
Jul 18 '05 #4
"Larry Bates" <lb****@swamisoft.com> wrote in message news:<n-********************@comcast.com>...
... 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
Jul 18 '05 #5
"be*******@aol.com" <be*******@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
Jul 18 '05 #6
David Bolen <db**@fitlinxx.com> 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
Jul 18 '05 #7
> >--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 =---

Jul 18 '05 #8

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

Similar topics

19
by: KefX | last post by:
I've been following the group a bit (somewhat loosely; discussions involving other languages or advanced concepts kind of lose me), and I see all this negativity (OMG Python's lambda is borken...
42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
18
by: kk | last post by:
I read this mailing list fairly often, and I am always amazed at what I learn (even not related to Python). I am relatively new to Python. I make my living developing mostly in Java. Python was a...
34
by: Blake T. Garretson | last post by:
I want to save some sensitive data (passwords, PIN numbers, etc.) to disk in a secure manner in one of my programs. What is the easiest/best way to accomplish strong file encryption in Python? ...
1
by: | last post by:
Can anyone help me on how to enumerate all the domains in a forest with VB.NET. Thanks, Dan Rhoads
17
by: MilkmanDan | last post by:
I'll be a college freshman this fall, attending Florida Institute of Tech studying electrical engineering. I was considering taking some classes in programming and computer science, and I...
4
by: pmcgover | last post by:
I enjoyed Paul Barry's September article in Linux Journal entitled, "Web Reporting with MySQL, CSS and Perl". It provides a simple, elegant way to use HTML to display database content without any...
852
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 418 open ( +5) / 3522 closed ( +1) / 3940 total ( +6) Bugs : 959 open (+13) / 6405 closed ( +5) / 7364 total (+18) RFE : 250 open...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.