"print int" would be nice

andreyw andreyw at mailandnews.com
Fri Jan 25 05:00:43 EST 2002

grante at visi.com (Grant Edwards) wrote in message news:<n4Y38.7703$Wf1.2496549 at ruti.visi.com>...

>The problem with having the compiler "auto-magically" convert
>values from one type to another...

The problem is not so common. All we need is redefine '+' operation for
strings. I read in UserString.py :

    def __add__(self, other):
        if isinstance(other, UserString):
            return self.__class__(self.data + other.data)
        elif isinstance(other, StringType) or isinstance(other, UnicodeType):
            return self.__class__(self.data + other)
            return self.__class__(self.data + str(other))

(I did not try to use this.)


More information about the Python-list mailing list