Issue 31888: Creating a UUID with a list throws bad exception

I found a problem by accident on Python 3.5.3 with the uuid library.

Running this:

from uuid import UUID
UUID(["string"])

This throws an AttributeError:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Tilman Krummeck\AppData\Local\Programs\Python\Python35-32\lib\uuid.py", line 137, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'list' object has no attribute 'replace'

This is for sure not intended to work, but should throw a type error in my opinion even before trying to create that UUID object.
This is a consequence of duck-typing and is common in Python. If you pass a value of wrong type, it is expected that you can get an AttributeError.

Explicit type checks clutter and slow down the code, and make it less flexible.

You can test an explicit type before calling uuid.UUID() in your code if you need.