diff --git a/doc/user/subtelties.rst b/doc/user/subtelties.rst index 1f4a184..213b937 100644 --- a/doc/user/subtelties.rst +++ b/doc/user/subtelties.rst @@ -18,6 +18,7 @@ It can then be instantiated in the axiom and modified during the simulation:: Axiom: Apex(ApexParameters(age=0)) dt = 1 derivation length: 2 + production: Apex(p) : p.age += dt produce Node() Apex(p) @@ -26,12 +27,12 @@ Creating the lsystem and running it the first time will produce the expected res >>> l = Lsystem('mycode.lpy') >>> lstring = l.derive() - >>> print lstring + >>> print(lstring) Node()Node()Apex(ApexParameters(age=2)) However, a strange behavior occurs when asking for the axiom.:: - >>> print l.axiom + >>> print(l.axiom) Apex(ApexParameters(age=2)) In fact, this behavior is due to the way python manage object. By default, complex objects @@ -40,7 +41,7 @@ are not copied but simply shared between variables.:: >>> a = ApexParameters(age=0) >>> b = a >>> b.age = 2 - >>> print a.age + >>> print(a.age) 2 The variables ``b`` and ``a`` point toward the same object in memory. This one will be destroyed only when no variable diff --git a/src/openalea/lpy/gui/simulation.py b/src/openalea/lpy/gui/simulation.py index 2734535..594b52d 100644 --- a/src/openalea/lpy/gui/simulation.py +++ b/src/openalea/lpy/gui/simulation.py @@ -355,7 +355,7 @@ def open(self,fname): elif answer == QMessageBox.Discard: os.remove(bckupname) os.chdir(os.path.dirname(self.fname)) - code = open(readname,'rU').read() + code = open(readname,'r').read() self.readonly = (not os.access(fname, os.W_OK)) self.textedition = recovery self.setEdited(recovery) @@ -367,7 +367,7 @@ def importtmpfile(self,fname): self.textedition = True self.setEdited(True) try: - lpycode = open(fname,'rU').read() + lpycode = open(fname,'r').read() self.opencode(lpycode) self._tmpfname = fname except: