I am out of trial and error again Lists

Chris Angelico rosuav at gmail.com
Sat Oct 25 01:49:12 EDT 2014


On Sat, Oct 25, 2014 at 4:40 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> Its generally accepted that side-effecting functions are not a good idea
> -- typically a function that returns something and changes global state.

Only in certain circles. Not in Python. There are large numbers of
functions with side effects (mutator methods like list.append,
anything that needs lots of state like random.random, everything with
external effect like I/O, heaps of stuff), and it is most definitely
not frowned upon.

In Python 3 (or Python 2 with the future directive), print is a
function, print() an expression. It's not "semantically a statement".

ChrisA



More information about the Python-list mailing list