Another Python rookie trying to port to C/C++ question.
dakidd at sonic.net
Thu Sep 25 23:21:06 CEST 2003
In article <bkvklh$e2i$02$1 at news.t-online.com>,
Peter Otten <__peter__ at web.de> wrote:
> Don Bruder wrote:
> > A week or two ago, I asked here about porting Python to C. Got some good
> > answers (Note 1) but now I've got another question. Actually, more a
> > request for clarification of a topic that both the Python tutorial and
> > docs leave a touch murky to my understanding.
> > Dictionaries/"dict" types...
> As you seem to feel at home with C, you could have a look into
> Objects/dictobject.c and Include/dictobject.h of the source distribution.
I may just go poking around there for more details.
Someone (via email) suggests that dicts are "supposed to be" (my
synopsis, not his words) a bit "murky", because all that's supposed to
be relevant is stuffing things into them, and pulling things out. That's
fine, completely admirable, and fully acceptable. *IF* You're working
directly in Python. I'm not. I'm working in a combination of C and C++,
attempting to duplicate the functionality of a program originally
written in Python. As such, the details *MUST* get clear if I'm to
create equivalent functionality. If only because I need to read data
that was written (presumably...) by a Python program. Hence, it becomes
neccesary to get down "in the muck" and actually know what's going on
behind the nice, tidy "dict.whosit.get()" (or whatever other operators
might be involved) interface that Python provides.
> > Which part of "I don't care how good, bad, or indifferent Python is
> > compared to C/C++, or any other language. I want this Python code to be
> > written in C/C++, end of discussion." wasn't clear enough for those of
> Smart people use efficient tools and build on existing libraries.
There's a statement that needed saying.... Not...
> If you are
> serious about the C++ part of your subject line, the Standard library aka
> STL has a map template that resembles Python's dict and might enhance both
> development and execution speed.
I'm *REASONABLY* serious. This port started life as a "Do you really
know as much about C++ as you think you do? Prove it! Take this Python
program and make it C++!" sort of "mid-term" test in my self-taught C++
course. It's rapidly degenerating (due to some technicalities of C++
that I've never before encountered, and therefore had no expectation of
trouble from) into "Let's just get the damn thing working in straight C,
then worry about trying to turn it into C++ later."
> Off topic (or not):
> A single person can start a discussion but not limit it, I think that's a
> feature of newsgroups rather than an annoyance.
Perhaps, and perhaps not. Guess it depends on your perspective. Having a
stream of insult and invective dumped into your mailbox because you've
made it plain that you don't consider somebody's "pet" language the
be-all and end-all of computer programming is hardly what I'd call a
Be that as it may, fortunately I have a thick enough hide to
figuratively "flip off" the jerk that was involved, and go on with life
knowing full well that in at least one respect, I'm so far superior to
him that words can't describe the gulf between us. Doesn't mean I'm not
going to mention that I think he's a hopeless putz, but I'm sure not
going to let it get me down to the point of giving up.
Don Bruder - dakidd at sonic.net <--- Preferred Email - SpamAssassinated.
Hate SPAM? See <http://www.spamassassin.org> for some seriously great info.
I will choose a path that's clear: I will choose Free Will! - N. Peart
Fly trap info pages: <http://www.sonic.net/~dakidd/Horses/FlyTrap/index.html>
More information about the Python-list