<p>I've created a small python script to toggle between two files I'm using for testing.</p>

<p>My question is, what is a good Python format style for the following code:</p>

<pre><code>import filecmp
import shutil

local = "local.txt"
remote = "remote.txt"
config_file = "C:\some\path\file.txt"

shutil.copyfile( remote if( filecmp.cmp(local, config_file ) ) else local, config_file  )
</code></pre>

<p>Or</p>

<pre><code>shutil.copyfile( remote 
                     if( filecmp.cmp(local, config_file ) ) 
                     else local,
                 config_file  )
</code></pre>

<p>Or</p>

<pre><code>tocopy = remote if( filecmp.cmp( local, config_file ) ) else local 
shutil.copyfile( tocopy, config_file )
</code></pre>

<p>Or what?</p>

<p>Also, what is the preferred way to name var in python for many-word names, is it "to_copy", "tocopy", "toCopy", "ToCopy"</p>

The most common naming I've seen is underscode separated words, to_copy.
As for the format style, I've seen no such agreement. I find
```
```
source = remote if filecmp.cmp(local, config_file) else local

shutil.copyfile(source, config_file)
```
```
to be the clearest among your options.
And seeing that everyone prefers to split the if I'd, at the very least, encapsulate the copyfile call in case you someday wish to change it:
```
```
def copy_to(source, destination):
    shutil.copyfile(source,destination)

if filecmp.cmp(local, config_file):
    copy_to(remote, config_file)
else:
    copy_to(local, config_file)
```
```