title: Input, test, and output per instance in Python
body: <p>I hope this question makes sense, I have been literally trying to figure this out for two complete days.</p>
  
  <p>I am trying to create a very small script, which I can then convert into a Flask web app, for comparing SPECint processor scores.</p>
  
  <p>A bit of background:</p>
  
  <p>From specint.org, I can download csv files containing benchmark information about processors and servers they have benchmarked.  The idea of my app is to do the following:</p>
  
  <ol>
  <li><p>Ask users for the benchmark they need (cint or rint), the server
  model, and the processor they're interested in. This must be done
  twice, for server 1 and server 2 so I can compare them.</p></li>
  <li><p>I need to check that the information they are entering is correct,
  i.e. if someone enters as processor name XYZ it should raise an
  error and prompt for entering a valid query. For this, I'm planning
  to dump a version of the whole database into my own database, so I
  can perform the check before actually downloading the csv file from
  the server.</p></li>
  <li><p>If the information entered is valid, I would dynamically generate the correct url for downloading and reading the csv file containing the benchmark score information, directly from SPECint's server.</p></li>
  <li><p>Once I have downloaded and processed the information for both servers, I would apply some simple math and return the results saying something like this:  "Server 1 is 10% faster/slower than server 2", or something like that.</p></li>
  </ol>
  
  <p>As you probably imagine, this will require a lot of duplicated code, so it seems it's the perfect use-case for a class.  I have been performing some tests, and the results are promising.</p>
  
  <p>However, my issue is that I have not been able to figure out how to capture the user inputs, test the inputs, download the corresponding csv file, and pass the user inputs all on a per-instance fashion, without having to duplicate code somewhere.  I have been searching and searching, and it seems a <code>@classmethod</code> is what I need, but I'm not sure since the use of it still seems quite esoteric to me (I'm a newbie) (ref: <a href="https://stackoverflow.com/questions/32721580/example-of-class-with-user-input">Example of Class with User Input</a>)</p>
  
  <p>For example, this is kinda working:</p>
  
  <p>My class:</p>
  
  <pre><code>class Baseline:
      def __init__(self, benchmark, model, processor):
          self.benchmark = benchmark
          self.model = model
          self.processor = processor
  </code></pre>
  
  <p>Capturing and printing instance results.</p>
  
  <pre><code>old_server = inputs.Baseline(test=input("Select benchmark: "),
                               model=input("Enter model: "),
                               processor=input("Enter processor: ")
                               )
  new_server = inputs.Baseline(test=input("Select benchmark: "),
                               model=input("Enter model: "),
                               processor=input("Enter processor: ")
                               )
  
  print(old_server.benchmark)
  print(old_server.model)
  print(new_server.benchmark)
  print(new_server.model)
  </code></pre>
  
  <p>As you can see, I'm already repeating code, and instead, I'd like to do everything from within the class, so I can simply call instances of it to both capture, test, download, and return the results.  As I said earlier, it seems that <code>@classmethod</code>is the answer, but I'd appreciate any guidance, hopefully with a bit of sample code so I can fully grasp the concepts.</p>