Minor 2.0 incompatibility

Michael Hudson mwh21 at cam.ac.uk
Tue Oct 24 03:58:30 EDT 2000


Timothy Docker <timd at macquarie.com.au> writes:

> The following code works under 1.5.2 but not under 2.0...
> 
>  | import string
>  | 
>  | class A:
>  |     fromString = string.atoi
>  |     def go(self, s):
>  |         print self.fromString(s)
>  | 
>  | a = A()
>  | a.go( '10' )

Hah!  Now that's cheeky.

> It's an easy enough fix, once I worked out what to do. But what is
> actually going on here? Something seems to have changed with the way
> that atoi now works, and somehow it worked by fluke before. Either
> way, the traceback is a bit cryptic.
> 
> Comments?

What's happened is that string.atoi is now a Python function, when it
used to be of builtin-function-or-method type.  No time for more
explaination now, I've got lectures to get too...

-- 
  Sufficiently advanced political correctness is indistinguishable
  from irony.                                           -- Erik Naggum



More information about the Python-list mailing list