[Python-Dev] NoneType(None) raises exception
barry at python.org
Fri Apr 26 04:05:27 CEST 2013
On Apr 25, 2013, at 04:09 PM, Ethan Furman wrote:
>We just fixed NoneType() to return None instead of raising an exception.
>Another use-case for calling NoneType is working with ORMs:
>result = 
>for field in row:
> type = get_type(field) # returns int, bool, str, NoneType, ...
I know this use case came up w.r.t. the enum discussion, but I'm not sure it's
relevant in a practical sense. Most of the Python ORMs I've worked with have
an extension facility to allow custom types/classes to be stored and retrieved
into database columns, and these converters always have intimate knowledge of
the types they're dealing with, both on the Python side and on the db side.
E.g. datetimes to take a pretty common standard Python data type.
So while a generic callable API is nice, I'm not sure you'll ever be able to
get full coverage over common Python types.
More information about the Python-Dev