title: How to generate a UUID of type long (to be consumed by a java program) in Python?
body: <p>How do you generate UUID of type long (64 bits - to be consumed by a java program) using Python?</p>
  
  <p>I read about the  <a href="http://docs.python.org/library/uuid.html" rel="nofollow noreferrer">UUID module</a>. So I played with it a bit:</p>
  
  <pre><code>&gt;&gt;&gt; import uuid
  &gt;&gt;&gt; uuid.uuid1().int
  315596929882403038588122750660996915734L
  </code></pre>
  
  <p>Why is there an "<strong>L</strong>" at the end of the integer generated by uuid.uuid1().int? If it's an integer shouldn't it be made up of pure numbers?</p>
  
  <p>Also according to the documentation uuid.uuid1().int will generate a 128 bits integer. I need an integer of type long (for a java program), that would mean it need to be 64 bits. Is it possible to generate a UUID of 64 bits instead of 128 bits?</p>
  
  <p>Another problem is that according to the <a href="http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex" rel="nofollow noreferrer">Python doc</a> a Python int is 32 bits while a Python long has "<em>unlimited precision</em>." What does "<em>unlimited precision</em>" mean? I need a 64 bits long int - what Python type would that be?</p>
  
  <p><strong>EDIT:</strong>
  Thanks for everyone's replies. Looks like UUID's are by definition 128 bits. In that case I probably shouldn't be using the term UUID. What I want to do is to <strong>generate a unique ID that is of type long (64 bits)</strong>. I thought UUID would do the job, but it looks like it can't. </p>
  
  <p>I need that ID as the document ID for Solr search engine. I'm using a real-time indexing Solr plugin <a href="http://snaprojects.jira.com/wiki/display/ZOIE/Zoie+Solr+Plugin" rel="nofollow noreferrer">Zoie</a>. And according to the documentation, "<em>Zoie assumes every record to be indexed must have a <strong>unique key</strong> and of type <strong>long</strong>.</em>"</p>
  
  <p>So given that's what I need, do you know what I can do to generate unique ID of type long?</p>
  
  <p>Thank you!</p>