On Thu, 25 Apr 2013 16:09:41 -0700
Ethan Furman <et...@stoneleaf.us> 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, ...
>       result.append(type(field))

I don't understand what the use case is. If you already have a value of
None, why do you call NoneType on it again?

Perhaps you should write:

   if not isinstance(type, field):
       field = type(field)

Rehatds

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to