built-in function- module name clash
jmlai at uci.edu
Mon Sep 6 12:08:07 CEST 2004
Olivier Vierlinck wrote:
> I've a python script using somecalls to the abs() built-in function.
> Now, I have to import a module named 'abs' too...
> The consequence if that line code like
> if (abs(a-b) < epsilon:
> does not work anymore, with this error msg:
> TypeError: 'module' object is not callable
> Clearly, the interpreter tries first to consider 'abs' as a module name rather than a built-in function name.
> Any idea on how to force it to call the abs() fct? Some kind of scoping or specific syntax?
> (I could rename the abs module too but ...)
> Thanks for your help,
Not very pretty, but it works.
More information about the Python-list