Guide to the python interp. source?

Tim Gahnström /Bladerman tim at bladerman.com
Sun Jul 28 15:23:51 EDT 2002


"Andreas Kostyrka" <andreas at kostyrka.priv.at>
>Am Sam, 2002-07-27 um 21.15 schrieb Tim Gahnström /Bladerman:
>> This is not the comon way, I know that but I am inclined to say that it
is
>> "undoubtley" more intuitive. Remember that this is a language for
complete
>> beginners with no programming experience.
>Well, and how does it work with recursion? Just wondering. ;)

Hmm... havn't thought about it yet but I dont think it will be a problem. It
might be a mess to explain but I don't really think it will be a problem.
def f(x):
    x=x+2
    if x>100:
        return
    f(x)

The result of x is obvious but it will probably be a mess to make that
happen in the interpreter. I don't know, it will ofcourse depend on how / if
I implement this CBR feature.

>[And recursion is such a fundamental pattern in programming, that you
>want your students to understand it quickly. Actually it's also needed
>for the maths.]

Deffinitley agree. Recursion will be possible and it will work in a
straightforward way. Recursion is still possible in languages that support
CBR so I am sure that it is possible.

>> Ofcourse this is just the simplest case possible and ther vill be issues
>> further down the way but I intend to handle them later. right now I am
>> getting to no the python interpreter, and its interaction with C and the
IDE
>> Maybe I have gotten the names wrong imutable/mutable/CBR/CBV etc etc. But
my
>> intentions are as outlined above.
>Well, I've got the strong impression, that you have not yet the feeling
>for the Python datamodel. While it can probably somehow done, you are in
>myriad of troubles. (And I suspect that you will not be able to work it
>out in a semester. Perhaps even two semesters ;) )

Well I am getting more and more aquainted to agree with you the more I hear
about the Python datamodel.
I didn't study that before I choose Python, I must admit that. I knew the
syntax and that it was a really good and extendable interpreter. That is why
I choose it.

>And consider the fact, that you would have to completely rewrite the
>python library also, because basically every piece of python code relies
>upon call by value.

That, ofcourse is impossible and won't happen. Still, if this is such an
utterly impossible feature I will just dropp it. That is not a fundamental
thing.

>> After I had written this mail actually thought that I had to add this on
>> top:
>> CBR is not a die hard feature that I must have if it gets a whole lot of
>> work to fix it. But I would apreciate anny suggestions on how to make it
>> with a limited amount of work.

>Forget it :)
Cough, cough... may I throw out a wild guess... you are on the higher end of
the age scale right? ;-)

>Write some small (~1000KLOC) applications in Python, do some data
>manipulation stuff, and then reconsider your project ;)

Actually that is what I am doing... I am writing a small application with
datamanipulation stuf :-)

>> That I understand but hadn't thought about it. What might be possible now
>> when you point it out like that is that maybe I can use the current
Python
>> model untill I come to a return statement in a function. At that time I
>> reattatch the internal object to the pointer/refference/name that I sent
in.
>> Clearly neither this is well thought over. I will come there in a month
or
>> so.
>Well, it's usually a bad idea to try fixing a language, that you do not
>know well enough. Especially if you don't know the basic "idioms".

Some people chose easy master thesises that they wouldn't show to a future
employer even with a gun to there head. (they usuallu succed)
Some people chose a project that have the possibillity of being awesome if
it is finished as the utopi is in there head.
I guess I am in the second group and might fail with a splash and I migh
also succed by an inch and end up haiting my project, but atleast I tried .

>>And I strongly question the fact if passing values by reference is
>>easier to understand than assigning values. (which call by value is)

Well that is your opinion not mine.

ask a complete novice what he think this peace of code will do

#Here is the program
x=3
inc(x)
print x

#Bellow is al the function deffinitions
def inc(x):
    x= x+1

You might have to tell him about assignment but not much else for him to
understand that this program will print 4
I think it is intuituve you don't I am fine with that but I dont agree.
But on the other hand, I am not ready to work that much to get it my way.


>> I might even throw in a preprocessor that changes the usercode into
python
>> right before it is ran. That ofcourse is not a good solution but I have t
in
>> mind.
>Nope. Preprocessor would be a quite bad idea.

I am just trying to see possibilities and give ideas, maybe someone will see
a possible solution.

Imagin this:
A whole lot of talented programmers is presented with an idea about creating
a language that works like Python except that it is uses CBR. Al of them
agree that it is impossible without rewriting the whole interpreter AND the
Python library.

To me can only mean two things.
1. It really is impossible
2. We have the programmers to blame for the "dot com" crash. :-) (means they
are narrow minded)

I don't know wich one is correct and I guess I am not (yet) ready to bet my
Master thesis on the second one.

Tim





More information about the Python-list mailing list