Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
fnord123
on Feb 20, 2017
|
parent
|
context
|
favorite
| on:
How copying an int made my code 11 times faster
You could use `from some_module import some_func` to get the same effect as some_func will be in the local namespace.
Cyphase
on Feb 20, 2017
[–]
That's what the top-level commenter was doing.
fnord123
on Feb 20, 2017
|
parent
|
next
[–]
Ok. It wasn't clear what "importing it locally" meant. I've worked with some people who would use that phrase to mean "copy paste it into the local file".
Cyphase
on Feb 20, 2017
|
root
|
parent
|
next
[–]
Fair point :P. I think I might have seen someone mean it like that as well in the past.
masklinn
on Feb 20, 2017
|
parent
|
prev
[–]
And a common stdlib trick is to bind these via function arguments e.g.
def foo(a, b, thing=util.thing): ...
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: