Guide to the python interp. source?

Tim Gahnström /Bladerman tim at bladerman.com
Sat Jul 27 09:19:43 EDT 2002


"Michael Hudson" <mwh at python.net> skrev i meddelandet
> "Tim Gahnström /Bladerman" <tim at bladerman.com> writes:
> > but I would also be happy if I found a small description och what
> > code is where,
>
> Well, the interpreter mainloop is in Python/ceval.c, object type
> implementations are in Object/*.c, ...
<...>
> Reading Include/object.h (and maybe other headers -- objimpl.h?) might
> give some clues.

That is a start atleast, thanks for that, I will start my explorations there

> > or anything like that. A lot of projects have "a small guide for
> > wannabe developers" but I havn't found anything like that for this
> There's http://www.python.org/dev/, but there's nothing of the sort
> you're asking for here, really.

I noticed, but thought that I just had missed it. I thought there must be
some where for such a large project. But the problem is ofcourse ever
present, "nobody likes to do documentation"

> > Things I want to change is for example, everything should be "call by
> > refferense",
> That may be very hard.  If you want things like this:
>
> def f(x):
>     x += 1
>
> i = 2
> f(i)
> i --> 3
>
> then you have problems.

That is exactly what I want to have, that is more intuitive I think and I
don't think it must be that hard either. It is not a speed issue so it must
not be a true CBR. I will probably figure out some ugly hack to make it seem
like CBR.
Maybe look into value/copy return as Alex Martelli mentioned. What I want is
not really CBR but the, from Ada known "in out parameters" or the Pascall
"var parameter".

> > redirect output,
> Probably easy.  Not quite sure what you mean here.

Didn't really mean anything briliant there, it was just small things that
poped out of my head while I was writing.
I meant I want all output (text, graphics, buttons, etc) in a certain window
in the IDE I am creating.

> > better errormesages,
> Examples?  Feel free to contribute these back to the project...

Ofcourse I will contribut them back if I create something there that is
usefull for alot of people.
Maybe the error messages I want to have is not so badly needed for
experienced programmers but more for beginners.
A traceback is for instance really cryptic to a novice programmer I want an
errormessage to look loike this.

"The program stopped running for some unknown reason. It is likely an error
on line 23 in the file "myprog.cod":
    if (max(3)>variable):
The error is probably caused by the call to the function max(). If you mean
to call the built in function max it must have two arguments, namely "val1"
and "val2" but you only supply it with one argument (constant 3).
On the other hand it might also be a misspelled call to your own function
maz() in "mylib.cod"
"

Currently the errormessage looks like this instead:

"Traceback (most recent call last):
  File "<pyshell#8>", line 1, in ?
    if max(3)>variable:
TypeError: min() or max() arg must be a sequence"

It is ofcourse likely that I won't be able to create an errormessage just
like I want but atleast that is my future goal.

Thanks alot for the time you took to answer.

Tim





More information about the Python-list mailing list