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))
if field is None, the resulting call is NoneType(None), and since NoneType
doesn't take any parameters we get an exception.
Is it worth filing a bug to have NoneType accept one optional argument, which defaults to None, and must be None, else
raise an exception?
Or should it be:
class NoneType:
def __new__(cls, *args, **kws):
return None
Which is basically what my 2.x none() helper function does...
--
~Ethan~
_______________________________________________
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