Why return None?

Peter Hansen peter at engcorp.com
Thu Aug 26 01:37:30 EDT 2004


Martin DeMello wrote:

> It seems to be a fairly common pattern for an object-modifying method to
> return None - however, this is often quite inconvenient.
...
> this is actually getting in my way a lot when scripting Blender - for
> instance, I can't say move(Vector([a,b,c]).normalize()), I have to do
> 	a = Vector([a,b,c])
> 	a.normalize()
> 	move(a)

By the way, the second version is much more readable than
the first, so perhaps there is a secondary reason for this
"return None" thing in addition to the more important one...

-Peter



More information about the Python-list mailing list