Returning none

Skip Montanaro skip at mojam.com
Thu Aug 26 18:46:42 CEST 1999


    Jeff> I think this proposal would break too much existing code, even for
    Jeff> a Python 2 change.

	...

    Jeff> Paul Prescod wrote:

    >> I think it would be more pythonish if this would return a runtime 
    >> (or even compiletime) error:
    >> 
    >> def foo():
    >> a=5
    >> 
    >> b=foo()
    >> 
    >> It shouldn't just return None. That's a source of errors.  This is
    >> obviously an incompatible change so I propose it for Python 2.

How about a compromise?  Perhaps Aaron Watters' PyLint can be modified to
bitch about functions without a return as the last statement?

Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/~skip/
847-971-7098   | Python: Programming the way Guido indented...




More information about the Python-list mailing list