source code size metric: Python and modern C++

Lulu of the Lotus-Eaters mertz at gnosis.cx
Thu Dec 5 16:30:35 EST 2002


|Lulu of the Lotus-Eaters <mertz at gnosis.cx> writes:
|> Neither 'sequence' nor 'number' are Python types.
|> List are types, as are tuples, as are ints, longs, floats.  But
|> 'sequence' and 'number' are more like schematic references to "some
|> type that behaves enough like we need it to."  In fact, custom
|> sequences (or custom numbers) word fine too.

David Abrahams <dave at boost-consulting.com> wrote previously:
|They're not concrete types. However, in "computer language developer
|lingo", they can be said to be types.

Abrahams and I don't differ on the fact here, just the name.  So it is
perhaps not of huge importance.

But I think my use is more natural.  For example, what I am calling
"type" is what the Python 'type()' function identifies, and what is
imported from the 'types' module.  Moreover, this notion of type is very
similar to the type declarations, type casts, etc. in a very large
number of programming languages.

The abstract notions "some kind of number" or "some kind of sequence"
are typically harder to pin down in -any- programming language.
Actually, a good word for them is "kind", in opposition to "type."

|I've been trying to convince Guido that it's important to nail
|down what we mean by "sequence" (and the rest of 'em) for some
|time now,

I partially agree here.  I don't think Python can or should "nail down"
what a sequence is.  I use lots of sequence like things when I write
Python, and they are not all the same as each other.  Different ones
support different operations, and any formal list that says "a sequence
must do X, Y, Z" will exclude some of my perfectly useful sequence-like
objects.  Either that, or it will be so general as to trivially include
almost everything.

But I wouldn't mind if there was some kind of canonical list of
"sequence like" options.  Function/module creator could include a little
chart of what their tool needs.  If the format was standard, it would be
easier to read quickly.  E.g.:

    Length:     Req
    Indexing:   Req
    Slice:      N/A
    iadd        N/A
    ...

Yours, Lulu...

--
 mertz@  _/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY: \_\_\_\_    n o
gnosis  _/_/             Postmodern Enterprises            \_\_
.cx    _/_/                                                 \_\_  d o
      _/_/_/ IN A WORLD W/O WALLS, THERE WOULD BE NO GATES \_\_\_ z e





More information about the Python-list mailing list