title: Python: how can I catch a exception and continue?
body: <blockquote>
    <p>Why do you have a list of both numbers and some other kind of object? It seems like you're trying to compensate for a design flaw.</p>
  </blockquote>
  
  <p>As a matter of fact, I want it work this way because I want to keep data that is already encoded in JsonedData(), then I want json module to give me some way to insert a 'raw' item data rather than the defaults, so that encoded JsonedData could be reuseable.</p>
  
  <p>here's the code, thanks</p>
  
  <pre><code>import json
  import io
  class JsonedData():
      def __init__(self, data):
          self.data = data
  def main():
      try:
          for chunk in json.JSONEncoder().iterencode([1,2,3,JsonedData(u'4'),5]):
              print chunk
      except TypeError: pass# except come method to make the print continue
      # so that printed data is something like:
      # [1
      # ,2
      # ,3
      # , 
      # ,5]
  </code></pre>