0

Module methods vs Hand-made functions

Hey Community, I was wondering about this : are module methods and native functions (like 'split()' or 're.split()') supposed to be faster ? If yes, are they necessarily so ? I'm asking because most of the time, I'd prefer using my own 'hand-made' algorithm rather than calling a specific module (especially if it's a function defined in the same script instead of opening a different file containing an equivalent). But now I wonder about this for optimality purposes. Please give your insights or opinions.

3rd Jan 2018, 3:55 PM
Nonov Urbiznes
Nonov Urbiznes - avatar
2 Answers
+ 3
I have no idea what language you are talking about. But generally, if you think your code is better than the standard library, you are either very very clever or a special kind of stupid.
3rd Jan 2018, 4:02 PM
1of3
1of3 - avatar
0
@1of3 : So I guess I'll fall in the second category :) But what I really want to know is whether importing a function makes execution slower than having the same defined inside the script. Because I guess there has to be a cost of time for opening and accessing the module and fetching the method. I included built-ins in the question just for the sake of discussion. Also, the examples I gave are python methods.
3rd Jan 2018, 8:20 PM
Nonov Urbiznes
Nonov Urbiznes - avatar