Re: Empty list as a default param - the problem, and my suggested solution

2021-08-14 Thread Martin Di Paola
I don't know if it is useful but it is an interesting metaprogramming/reflection challenge. You used `inspect` but you didn't take its full potential. Try to see if you can simplify your code and see if you can come with a decorator that does not require special parameters. from new import N

Re: Empty List

2016-06-27 Thread Pierre-Alain Dorange
Elizabeth Weiss wrote: > What is the point of this code?: > > word=[] > print(word) > > The result is [] > > When would I need to use something like this? You often need to intialize a list, sometime with (empty) = []. Then after initializing you should do "something" that perhaps will fill

Re: Empty List

2016-06-26 Thread Christopher Reimer
On 6/26/2016 8:13 PM, Elizabeth Weiss wrote: Hi There, What is the point of this code?: word=[] print(word) The result is [] When would I need to use something like this? Thank you! Sometimes you need to assign an empty list to a variable prior to using it in a looping structure. Here'

Re: Empty List

2016-06-26 Thread Steven D'Aprano
On Mon, 27 Jun 2016 01:13 pm, Elizabeth Weiss wrote: > Hi There, > > What is the point of this code?: > > word=[] > print(word) > > The result is [] > > When would I need to use something like this? As given, never. Nor would you need: num = 0 print(num) It's pretty boring, trivial code th