The performance improvement would result from less code being executed especially if validation would be complex but there's also some cost involved in calling another function which in most cased can be neglected though.
Add a comment. You are in the right direction. Before calling the existing recursive method, you need to validate the parameter and take some action if the parameter is invalid You haven't given the details on what to validate. Out of curiosity, does wrapper function improve the performance of the recursive function?? James the wrapper function means the argument is only validated once rather than every recursive call.
Also, you can create different such wrapper functions that can do different things while having the core logic separately — user7. MrsNickalo MrsNickalo 1 1 silver badge 6 6 bronze badges. Iancu Vlad Iancu Vlad 31 2 2 silver badges 2 2 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta. Now live: A fully responsive profile. Related Hot Network Questions. We strive for simplicity and accuracy with every definition we publish. If you have feedback about the Wrapper definition or would like to suggest a new technical term, please contact us. Want to learn more tech terms?
Subscribe to the daily or weekly newsletter and get featured terms and quizzes delivered to your inbox. You can unsubscribe or change your frequency setting at any time using the links available in each email. Please contact us. We just sent you an email to confirm your email address. Once you confirm your address, you will begin to receive the newsletter. Definitions by TechTerms. Tech Factor? Easy Normal Medium Hard Expert. Writing code in comment? Please use ide.
Load Comments. What's New. Most popular in Python. Python String replace Different ways to create Pandas Dataframe. More related articles in Python.
0コメント