[Tutor] New to this list ....

Barry Drake bdrake at crosswire.org
Fri Mar 30 19:35:13 CEST 2012

On 30/03/12 17:22, Prasad, Ramit wrote:
> Unlike C, the parenthesis in if statements and returns are not 
> necessary. Furthermore, the way Python binds names means that 
> modifying the list in getflags modifies it in the callee. No need to 
> return and reassign results. 

This is lovely.  It's so much friendlier than c.  I'm used to c 
variables going out of scope once you leave the called function.  I 
imagine if you want to leave the variables unchanged, you have to 
re-assign them inside the function.  I quite like it that way.
> Be careful of "results = [0] * 3". This style works fine for immutable 
> types (int, float, str) but does not work as people new to Python 
> think it does.

Thanks for the warning.

 From Barry Drake - a member of the Ubuntu advertising team.

More information about the Tutor mailing list