while true: !!!

Carsten Geckeler nospam at no.spam
Mon Dec 18 17:53:55 EST 2000

On Mon, 18 Dec 2000, Steve Lamb wrote:

> On Mon, 18 Dec 2000 17:05:51 +0100, Alex Martelli <aleaxit at yahoo.com> wrote:
> >I think it would be inconsistent, un-Pythonic, to add a fundamental type for
> >'conceptual' reasons, without any practical, measurable benefit.  For
> >example, Python does away with the distinction between 'a character' and 'a
> >string of length 1' -- a distinction that is religiously maintained in C,

Not fair!  C is a lowlevel language (relatively to interpreter languages
as Python etc.).  In C you can say
	s[3] = char
Do you know anything faster than this?  It just writes the byte char into
the memory space pointer str + 3.  In most cases strings do consist of
chains of bytes in memory.

> >Pascal, Java, etc, and does have a basis in both 'conceptual' and
> >machine-level considerations -- yet the strong conceptual *simplification*
> >arising from just doing away with the distinction appears to be quite
> >positive.
>     I can attest to that.  I have tough times in C, Pascal and other such
> languages because of one consideration they make that Perl and Python do not.
> Data is data.  Forgiving me my discussion earlier where I said Python doesn't
> do that (when compared to Perl) it still does it in all the ways that count.
> I don't have to worry about how large or small of a block of space to allocate
> to my strings or arrays.  It's a string, not a string[80] that I might one day
> want to stuff 81 characters into.  :/

Please, don't be so mean to C.  It's such a nice programming language!
Remember, Python itself is programmed in C.  ;)

But to your point:  If you are sure that your string is always shorter
than 79 characters, it'n no faster way than doing it as C.  No overhead
due to range checking and reallocating.  But of course, from the everyday
user's point, interpreter languages as Python or Perl do a nicer job.  But
every language has it's field of appliance.  Just imagine programming a OS
kernel in Python... ;)

Cheers, Carsten
Carsten Geckeler:  carsten dot geckeler at gmx dot de
To get proper email-address replace `dot' and `at' by the corresponding symbols.

More information about the Python-list mailing list