Is it Pythonic to passed in arguments in a function that will be used by a function inside it?
<p>Is there a better way to do this? Like I'm passing in arguments to <code>func</code> that will be used in <code>inside_func</code> function? </p>

<pre><code>def inside_func(arg1,arg2):
    print arg1, arg2 
    return

def func(arg1, arg2):
    inside_func(arg1,arg2)
    return
</code></pre>

<p>Of course it is.</p>

<p>Your outer function provides a service, and to do its job it may need inputs to work with. <em>How it uses those inputs</em> is up to the function. If it needs another function to do their job and they pass in the arguments verbatim, is an implementation detail.</p>

<p>You are doing nothing more than standard encapsulation and modularisation here. This would be correct programming practice in any language, not just Python.</p>

<p>The Python standard library is full of examples; it is often used to provide a simpler interface for quick use-cases. The <a href="https://hg.python.org/cpython/file/v3.5.2/Lib/textwrap.py#l369" rel="nofollow"><code>textwrap.wrap()</code> function</a> for example:</p>

<pre><code>def wrap(text, width=70, **kwargs):
    """Wrap a single paragraph of text, returning a list of wrapped lines.

    Reformat the single paragraph in 'text' so it fits in lines of no
    more than 'width' columns, and return a list of wrapped lines.  By
    default, tabs in 'text' are expanded with string.expandtabs(), and
    all other whitespace characters (including newline) are converted to
    space.  See TextWrapper class for available keyword args to customize
    wrapping behaviour.
    """
    w = TextWrapper(width=width, **kwargs)
    return w.wrap(text)
</code></pre>

<p>This does nothing else but pass the arguments on to other callables, just so your code doesn't have to remember how to use the <code>TextWrapper()</code> class for a quick one-off text wrapping job.</p>

python function