[Python-Dev] new language ideas

Michael Chermside mcherm at mcherm.com
Mon Nov 3 08:35:57 EST 2003


Brian Rzycki writes:

> Multiline comments

Already got it. Triple quoting.

> __doc__ variable

Just making __doc__ a dictionary instead of a string doesn't achieve
anything *unless* there is a fairly standard set of expected keys
in this dictionary. (This is documentation, so the list of standard
keys doesn't have to be universal but without a common set of keys
you can expect to encounter, the only thing you can really do is to 
print out the entire contents of the dictionary, and if all you can
do is print it you might as well just be using a string.)

You write:
> Think author, 
> webpage, and version at the global scope and pre/post conditions, 
> dynamically created information about a function/class.

which is an interesting-sounding list, but if I saw a PEP which 
proposed making __doc__ a dictionary which *didn't* specify just what
the "common" key would be and what they would contain, then I'd be
-1 on it. And if it *did* specify, I imagine there would be far more
controversy than you expect.

> bit access of integers
> ----------------------------
> Like strings, we can use [] to index into python integers.

Hmm... very interesting, actually. But on reflection, I think we're
better off leaving integers as *numbers* and having a *separate* type
for bitmasks. This separate type could even be written in Python
(I doubt the speed of a C implementation would be worthwhile... the
real advantage of the type would be ease of use, not performance).
Clearly it would have a convert-to-integer feature (perhaps one which
would let you specify whether you wanted signed or unsigned, and what
width, and what endian-ness, etc.).

> alternative base notation
> ---------------------------------
> Python inherited C's notation for numbers of non-decimal bases.  I 
> propose another with simpler syntax: number_base.

Definite -1 from me. Several reasons. Here's a number in hex:
     b4a0_16
Oh wait... sorry, that's not a number, that's an identifier.

Another reason is that it's just not something that is done all
that frequently. Another reason is that we already have TWO syntaxes
for doing numbers in different bases: There's the 0x prefix for
hex and the 0 prefix for octal (but if I had my way we'd dump that...
who uses octal?). And there's the "int('<number>', <base>)" syntax
which has just a few more characters than your solution and is IMHO
more readable.

Even if I'm shooting most of these down, don't give up... you're
certainly injecting a little creative thought into the process.
Sometimes that stirs up really exciting ideas.

-- Michael Chermside




More information about the Python-Dev mailing list