Static typing (was Re: Java guy interested in Python)

Alex Martelli aleaxit at yahoo.com
Sun Mar 11 15:01:08 EST 2001


"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.984334635.27345.python-list at python.org...
> [Rainer Deyke]
> > When I type 'int i;' in C++, what I really mean is "'i' behaves like an
> > integer variable.".
>
> Since that's all "int i;" *can* mean in C++, seems tautological <wink>.

Surely you're joking, Mister Peters?

    class int {
        public:
            int(const char*=0);
            ~int();
            const char* data() const;
    };

    int i;

Isn't this perfectly legal C++, meaning something very different from
"i behaves like an integer variable"...?  int is no "reserved word",
after all.


Back to "built-in" int...:

> > The limited range of type 'int' is part of its defined semantics,
> > as is its fast performance.
>
> I expect you'll search in vain for a promise in the std that ints are
"fast"
> <wink>.

3.9.1.2 says "plain _int_s have the natural size suggested by the
architecture of the execution environment", and it would take
quite a sea-lawyer to assert that the 'natural' size in this context
is any BUT the one providing the best performance on said
execution-environment's architecture.  But I think you are right
that this is not QUITE a "promise":-).


Alex






More information about the Python-list mailing list