title: Why make an instance of a class before using it?
body: <h2>Original question</h2>
  <p>I've seen pretty much in all examples people first making an instance of a class:
  <code>ss = StandardScaler()</code> and only after that use the methods from the instance: <code>ss.fit_transform(df)</code>, rather than calling the method on the class itself: <code>StandardScaler().fit_transform(df)</code>.</p>
  <p><strong>Is this because of:</strong></p>
  <ol>
  <li>There are cases, which would throw an error otherwise.</li>
  <li>There are cases, which don't throw an error, but produce different results (scary!)</li>
  <li>Prevents repetition of code (but it's ok, if its used only once.)</li>
  <li>It's better to do just one thing on one line of code.</li>
  <li>Aesthetics &amp; opinion.</li>
  <li>Some other reason, please let me know!</li>
  </ol>
  <h2>Some answers thus far</h2>
  <p>Thank you for the answers that raised many clarifying points, here's some as I understand them. Please correct me if I'm mistaken.</p>
  <h3>Potential reasons I suggested for making an instance first:</h3>
  <p><strong>There are cases, which would throw an error otherwise.</strong></p>
  <ul>
  <li>Thomas Weller's answer below states that there shouldn't be, since calling the method on the class creates a temporary instance - it just doesn't get stored in a variable.</li>
  </ul>
  <p><strong>There are cases, which don't throw an error, but produce different results (scary!)</strong></p>
  <ul>
  <li>Thomas Weller's answer below states that there shouldn't be, since calling the method on the class creates a temporary instance.</li>
  </ul>
  <p><strong>It's ok to call on the class itself, if its used only once.</strong></p>
  <ul>
  <li>This seems to be true, as there is no reason to store the instance in a variable and repetition is not a problem.</li>
  </ul>
  <p><strong>It's better to do just one thing on one line of code.</strong></p>
  <ul>
  <li>Readability is more important than doing just one thing per line. In my opinion, both versions are just as clear and readable.</li>
  </ul>
  <p><strong>Aesthetics &amp; opinion</strong></p>
  <ul>
  <li>There's some of these involved as well.</li>
  </ul>
  <p><strong>Some other reason, please let me know!</strong></p>
  <ul>
  <li>Of course object oriented programming is useful in many ways, but my question concerned only the isolated use of a class and a method someone else has already programmed for me.</li>
  <li>My question wasn't concerned whether or not you can put parameters inside the class or the method - my example actually does this: <code>np.random.default_rng(0).integers(10, size=(4,5))</code></li>
  </ul>
  <h2>Code Example</h2>
  <pre><code>import numpy as np
  from sklearn.preprocessing import StandardScaler
  
  # Here I'm using .interegs() without making an instance first
  int_array1 = np.random.default_rng(0).integers(10, size=(4,5))
  
  # Here I'm using .interegs() without making an instance first
  int_array2 = StandardScaler().fit_transform(int_array1)
  
  # This time instantiating before using for comparison
  rng = np.random.default_rng(0)
  int_array3 = rng.integers(10, size=(4,5))
  ss = StandardScaler()
  int_array4 = ss.fit_transform(int_array3)
  
  print(int_array1)
  print(int_array2)
  print(int_array3)
  print(int_array4)
  </code></pre>
  <p>Output has the same results regardless of instantiation.</p>
  <pre><code>[[8 6 5 2 3]
   [0 0 0 1 8]
   [6 9 5 6 9]
   [7 6 5 5 9]]
  [[ 0.88354126  0.22941573  0.57735027 -0.72760688 -1.70856429]
   [-1.68676059 -1.60591014 -1.73205081 -1.21267813  0.30151134]
   [ 0.2409658   1.14707867  0.57735027  1.21267813  0.70352647]
   [ 0.56225353  0.22941573  0.57735027  0.72760688  0.70352647]]
  [[8 6 5 2 3]
   [0 0 0 1 8]
   [6 9 5 6 9]
   [7 6 5 5 9]]
  [[ 0.88354126  0.22941573  0.57735027 -0.72760688 -1.70856429]
   [-1.68676059 -1.60591014 -1.73205081 -1.21267813  0.30151134]
   [ 0.2409658   1.14707867  0.57735027  1.21267813  0.70352647]
   [ 0.56225353  0.22941573  0.57735027  0.72760688  0.70352647]]
  </code></pre>