When necessary, it's still possible to use 'import stuff as shortcut' (well, it's actually not a shortcut in this cas :-), instead of 100 explicit imports.
On Jun 2, 12:43 pm, "Fredrik Johansson" <[EMAIL PROTECTED]> wrote: > On Mon, Jun 2, 2008 at 11:48 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > > What do you think Fredrik? Let's use explicit in mpmath as well, at > > least in SymPy? > > When a function name changes, you have to change not just the function > and the code that refers to it, but also lots of imports. You can > catch errors this way, but those imports should be checked via unit > tests anyway. In many ways I think explicit imports are a bit like > (explicit) static type declarations, which I don't like :-) > > As I've said, it adds a lot of clutter when there are 50 items to > import. A possible solution is to keep the namespace of the entire > module (requiring just one import), but that results in even more > clutter if the imported objects are used in 100 places in the code. > > Note that some mpmath modules define __all__, which I think is a good > compromise, as it prevents "leakage" via subsequent imports. So it > doesn't really matter to SymPy what mpmath does to import items > between modules internally. > > The argument that things get clearer is valid. But it might be even > better with a comment such as > > # Here we import all the low level functions fadd, fmul, etc, which in > this module will be wrapped to operate on mpf instances > from lib import * > > Fredrik --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---
