Living without static member functions
Mikael Olofsson
mikael at isy.liu.se
Mon Jan 24 09:49:59 EST 2000
On 24-Jan-00 Sami Hangaslammi wrote:
> Mikael Olofsson <mikael at isy.liu.se> wrote in message
> news:XFMail.000124133458.mikael at isy.liu.se...
>
> <snip>
>
> > a=Milkman('Mikael')
> > b=Milkman('David')
> > a=Milkman('Mattias')
> >
> > then allMilkmen would be
> >
> > {'Mikael': <__main__.Milkman instance at e0f68>,
> > 'David': <__main__.Milkman instance at e0de8>,
> > 'Mattias': <__main__.Milkman instance at e0aa0>}
> >
> > Hence, allMilkmen still keeps a reference to the first instance
> > (Mikael), which has been replace by the third (Mattias).
>
> Because objects use reference semantics, Mattias does NOT replace
> Mikael. The only thing changed is the local variable 'a' which now
> referes to another object.
Which was exactly what I meant.
/Mikael
-----------------------------------------------------------------------
E-Mail: Mikael Olofsson <mikael at isy.liu.se>
WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date: 24-Jan-00
Time: 15:46:59
This message was sent by XF-Mail.
-----------------------------------------------------------------------
More information about the Python-list
mailing list