Some notes

bearophile bearophileHUGS at
Tue Oct 12 22:38:35 CEST 2004

This is my first post here, I hope this is the right place to talk
about such things. I have few comments and notes on the Python
language. I've just started to learn it; this is negative because I'm
ignorant still, but it's also positive because I can still see details
that later probably I'll start to ignore.

Some of the functions of IPython seem good and simple, and I think
some of them can be integrated into the main Python line.

There are lots of different ways to make GUIs for Python programs, I
think that Gui4Cli ( is nice, and it can
be interesting to see it more integrated with Python. At the moment
there is only this interface, but it's not good:

Is Python3000 going to come eventually? It will break a lot of
compatibility, so it will be the right moment to change/fix other
things too. Here are some ideas (probably there are errors, but I hope
to learn from my mistakes):

- TABs can be accepted only inside comments. 

- The optional static typing seems a quite nice thing (for compilers
too, they can produce faster code. It can probably allow faster and
smaller arrays, like those of numarray).

- The functional IF seems interesting, like:
if(cond, code1, code2)
(Or maybe a different syntax, that allows elseif too.)

- Functions containing yield can be defined in a different way, like:
generator name(params)
This idea comes from David Mertz:

- "mod" can substitute the % operator. This gives cleaner (but a bit
longer) code.

- The string Formatting like %(#)03d can be good for C programs, but
probably can be invented a much simpler and nicer syntax for a high
level language like Python (does string.Template from 2.4 solve
this?). (Python is "based" on C, but putting C syntax inside Python
sometimes seems a bad thing to me.)

Maybe the : at the end of some blocks can be removed or it can become
optional (but then the newline is probably necessary):
for i in <suite>: <code>

for i in <suite>

if <cond>

def name(params)

- Assigns and equal symbols seem wrong/misplaced. So:
==  can become =
=  can become <-
the <- is probably a more correct symbol, but it can produce problems:
b <- 6
b < -6
So maybe
==  can become =
=  can become :=
(This reminds me Pascal syntax.)

In time, Python seems to become more similar to the Mathematica (and
in IPython this is even explicit) ^_^

Bear hugs,
(Remove HUGS to mail me)

More information about the Python-list mailing list