Preferences

what is the point of this? you can just import inside function definitions:

    def antislash(A, b):
        from numpy.linalg import solve
        return solve(A, b)
thus numpy.linalg is only imported the first time you call the antislash function. Much cleaner than a global import.

Ignore wrong traditions. Put all imports in the innermost scopes of your code!


That's a hack that forces you to duplicate and hide imports. The tradition is to specify imports at the top because it's that much better readability wise.

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal