Thanks for all these clear and knowledgeable answers. I'm much clearer on this now and will read up a bit more around these subjects.
John On Mon, Jun 24, 2013 at 10:59 AM, Peter Otten <__pete...@web.de> wrote: > John Steedman wrote: > > > Hi Tutors, > > > > I'm confused by the following possible contradiction. Would someone > please > > explain or point me to the right docs. > > > > FACT 1 > > > > "Variables in python hold references to objects." > > http://en.wikipedia.org/wiki/Python_syntax_and_semantics > > > > FACT 2 > > > >>>>def Increment ( x ) : > >>>> // return x + 1 > >>>> x = x + 1 > >>>> return x > >>>> > >>>>y = 1 > >>>>z = Increment ( y ) > >>>>y > > 1 > >>>>z > > 2 > > > > By FACT 1 x should be a reference parameter...? > > By Fact 2 x would seem to be a copy...? > > > > What in the world of dynamic typing is going on? > > There's a big confusion in terminology. Does > > http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing > > help? Here's a more detailed explanation: > > < > http://learntofish.wordpress.com/2012/01/09/call-by-object-reference-call-by-sharing/ > > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor