Re: Death to tuples!



Antoon Pardon a écrit :
On 2005-11-30, Duncan Booth <duncan.booth@xxxxxxxxxxxxxxx> wrote:

Antoon Pardon wrote:

But lets just consider. Your above code could simply be rewritten
as follows.

 res = list()
 for i in range(10):
    res.append(i*i)


I don't understand your point here? You want list() to create a new list and [] to return the same (initially empty) list throughout the run of the program?


No, but I think that each occurence returning the same (initially empty)
list throughout the run of the program would be consistent with how
default arguments are treated.

What about that : def f(a): res = [a] return res

How can you return the same list that way ? Do you propose to make such construct illegal ?
.




Relevant Pages

  • Re: mysql problem
    ... > Thus, res becomes null. ... mysql_store_resultalso returns a null pointer if reading of the ... An empty result set is returned if there are no rows returned. ...
    (comp.lang.c)
  • include as string
    ... I have a php file like the following: ... Before this I have opened a sql query and $res has the resultset. ... But $res now seems to be empty. ... If I print_rinto my function it returns of course data. ...
    (comp.lang.php)
  • Ply(LALR) and Yacc behaving differently
    ... I am trying to implement a small compiler in python and, ... Perhaps this belongs on some compiler list, but I couldn't decide if it ... Empty ... def p_Block: ...
    (comp.lang.python)
  • Re: increasing counter whithin loop?
    ... > each do |elt| ... also got to handle break specially, and handle the empty case. ... Ah, I did just notice that 'retry' won't work with this, as both 'next' ... def initialize(array) ...
    (comp.lang.ruby)
  • Re: any(), all() and empty iterable
    ... I was getting some surprising false positives as a result of not expecting ... which returns False when 'iterable' is empty. ... def all: ... Try Googling for: ...
    (comp.lang.python)