Hi all,

given python description below

import random

class Node:
         def __init__(self):
                 self.nachbarn = []

class Graph(object):
        # more code here
         def randomizeEdges(self, low=1, high=self.n):
                 pass


graph = Graph(20)
graph.randomizeEdges(2,5)

I am burned by high=self.n
quick test with

cnt = 1
def foo():
        global cnt
        cnt += 1
        return cnt

def bar(x=foo()):
        print x

bar()   # 2
bar()   # 2
bar()   # 2

this is not behaviour C++ programmer would expect
does someone know why this kind of behaviour is/was choosen?

Regards, Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to