Few things

bearophile bearophileHUGS at lycos.com
Thu Nov 25 19:41:00 EST 2004


Hello,
here are a four more questions (or suggestions) for the language
(probably people have already discussed some of/all such things:

I've seen the contracts for Python:
http://www.wayforward.net/pycontract/
http://www.python.org/peps/pep-0316.html
They look interesting and nice, how Python developers feel about
accepting something like this in the standard language? (Maybe they
are a bit complex).


I think it can be useful a little stat standard module that computes
permutations, combinations, median (quickselect), etc. There is even a
C implementation (of most of them):
http://probstat.sourceforge.net/
Probably some Win users can appreciate to have this already compiled
(and built in).


A command like this:
print 0x9f, 054135
This prints an hex and octal. I think the syntax for the hex is a bit
ugly; and the syntax for the octal looks just dangerous (and wrong) to
me.


In some python source codes that I'm finding around, I find things
like:
def foo():
    '''This is just a
silly text'''
...

Because:
def foo():
    '''This is just a
       silly text'''
print foo.__doc__

Outputs:
This is just a
       silly text

I think a better syntax for such multiline strings can be something
like: remove from all the beginnings of the lines successive to the
first one a number of spaces equal to the position of ''' in the
soucecode.
With this sintax such print outputs:
This is just a
silly text

Note: even less indentation of the lines successive the first one can
be simply ignored:
def foo2():
    '''This is just a
     silly text'''
print foo.__doc__

Outputs:
This is just a
silly text

Hello,
Bearophile



More information about the Python-list mailing list