title: Is there predefined class for URL in Python?
body: <p>I am looking for something like <a href="http://download.oracle.com/javase/6/docs/api/java/net/URL.html" rel="noreferrer">java.net.URL</a> in python-modules, Django, Zope or wherever in Python. 
  I want it preferably from the semantics <strong>reason</strong>, because the result of analysis of concerned program implies that the URL plays an essential role in it. The consequence is that such URL class also will have great practical usage in that program.</p>
  
  <p>Of course I could write such class on my own, but I'd like to look around before I start to <strong>reinvent the wheel</strong>.</p>
  
  <p>I did look at <a href="http://docs.python.org/library/urllib2.html" rel="noreferrer">urllib2</a> and <a href="http://docs.python.org/library/urlparse.html" rel="noreferrer">urlparse</a>. The <code>urlparse</code> basically has the functionality I need, but it doesn't encapsulate it into a class like <code>java.net.URL</code>. Regarding my analysis of my program it works upside-down.</p>
  
  <p>I looked also into the source code of <code>urlparse</code> at the classes <code>SplitResult</code> and <code>ParseResult</code>. They have some basic functionality and they can be used for subclassing. But I'll have to rewrite rest of the urlparse functions as the subclass methods.</p>
  
  <p>I found also <a href="http://www.egenix.com/products/python/mxBase/mxURL/" rel="noreferrer">mxURL - Flexible URL Datatype for Python</a>. It is very close to what I really want. Only it seems to be quite an overkill for my purpose.</p>
  
  <p>Can anyone suggest another option? Should I proceed with reinventing the wheel?</p>
  
  <p><strong>My solution:</strong></p>
  
  <p>To get my URL class I did basically two things:</p>
  
  <ol>
  <li>Inherit from <code>urlparse.ResultMixin</code>. </li>
  <li>Define function which only calls <code>urlparse.urlparse()</code> and transforms results to
  parameters of URL instance.</li>
  </ol>