Assignment versus binding

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Oct 5 09:20:50 EDT 2016


Chris Angelico wrote:
> So how do you handle something that, by its nature, has BOTH side
> effects and a return value?

A Pascal purist would probably say that you should make
it a procedure, and use var parameters to pass back
any results.

In the case of something like the unix write() call, this
may actually make more sense anyway, because in Pascal
you can't just ignore the return value of a function
if you don't want it. Passing a result parameter that
you don't use is probably less obtrusive to read than
assigning to a variable that you don't use.

-- 
Greg



More information about the Python-list mailing list