Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/uuid.rst

    r2 r391  
    226226   >>> import uuid
    227227
    228    # make a UUID based on the host ID and current time
     228   >>> # make a UUID based on the host ID and current time
    229229   >>> uuid.uuid1()
    230230   UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')
    231231
    232    # make a UUID using an MD5 hash of a namespace UUID and a name
     232   >>> # make a UUID using an MD5 hash of a namespace UUID and a name
    233233   >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
    234234   UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
    235235
    236    # make a random UUID
     236   >>> # make a random UUID
    237237   >>> uuid.uuid4()
    238238   UUID('16fd2706-8baf-433b-82eb-8c7fada847da')
    239239
    240    # make a UUID using a SHA-1 hash of a namespace UUID and a name
     240   >>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
    241241   >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
    242242   UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
    243243
    244    # make a UUID from a string of hex digits (braces and hyphens ignored)
     244   >>> # make a UUID from a string of hex digits (braces and hyphens ignored)
    245245   >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')
    246246
    247    # convert a UUID to a string of hex digits in standard form
     247   >>> # convert a UUID to a string of hex digits in standard form
    248248   >>> str(x)
    249249   '00010203-0405-0607-0809-0a0b0c0d0e0f'
    250250
    251    # get the raw 16 bytes of the UUID
     251   >>> # get the raw 16 bytes of the UUID
    252252   >>> x.bytes
    253253   '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
    254254
    255    # make a UUID from a 16-byte string
     255   >>> # make a UUID from a 16-byte string
    256256   >>> uuid.UUID(bytes=x.bytes)
    257257   UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
Note: See TracChangeset for help on using the changeset viewer.