Francesc Altet wrote:
> A Dilluns 02 Gener 2006 14:53, Ed Schofield va escriure:
>>>Then what do you think about an integer default that is redefinable by
>>>>the user? For example:
>> >>> import scicore / whatever
>> >>> scicore.default_dtype = float64
>>>>Then zeros(), empty(), and ones() (any others?) would use the new
>>default. I think the flexibility would be nice, and it should be
>>feasible ...
>>> Yes. I think this would be really nice to have. That way, the
> 64/32-bit dichotomy would disappear.
Is this supposed to be a fully global setting? If so, what about
import numerix
numerix.default_dtype = 'something'
import somemodule
somemodule.foo()
boom!
Now, the foo() call either:
1. blows up, because it had unqualified zeros() calls whose dtype has now
changed, or
2. resets numerix.default_type back, and your code blows up next.
I think this can be handled with a _call_ (numerix.set_default_dtype()), but
it requires special stack-handling code so that numerix can know to apply the
new default only to calls made from the same module.
Cheers,
f