Re: Something that confuses me in python

2020-06-05 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Something that confuses me in python Or more briefly than a link, Python only ever evaluates default arguments once for efficiency and lists are modified in place.The big thing about Python that people probably aren't used to is that executing the part of the code that *defines*

Re: Something that confuses me in python

2020-06-05 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
Re: Something that confuses me in python [Mutable Default Arguments] URL: https://forum.audiogames.net/post/537528/#p537528 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames

Something that confuses me in python

2020-06-04 Thread AudioGames . net Forum — Developers room : zakc93 via Audiogames-reflector
Something that confuses me in python So given the following:def f(x=[]):    x.append(1)    return xprint(f(),f())The output is [1, 1] [1, 1]So it seems like the function creates a global list which it appends to whenever it is called without parameters, and returns a reference to that