Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 10:48, Albert-Jan Roskam wrote: > What I like about both namedtuple and AttrDict is attribute lookup: that > makes code so, so, s much easier to read. This seems to be a nice > generalization of your code: > > class Point(object): > > def

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Albert-Jan Roskam
> From: oscar.j.benja...@gmail.com > Date: Thu, 14 Apr 2016 21:34:39 +0100 > Subject: Re: [Tutor] question about __copy__ and __deepcopy__ > To: sjeik_ap...@hotmail.com > CC: tutor@python.org > > On 14 April 2016 at 20:38, Albert-Jan Roskam wrote: > > Hi, > > > > Lately

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 09:55, Albert-Jan Roskam wrote: > > Heh, it's my fancy __str__ method that confused me. This is what I get when I > run my code without __copy__ and __deepcopy__ > runfile('/home/albertjan/Downloads/attrdict_tutor.py', >

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Albert-Jan Roskam
> Date: Fri, 15 Apr 2016 16:30:16 +1000 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] question about __copy__ and __deepcopy__ > > On Thu, Apr 14, 2016 at 07:38:31PM +, Albert-Jan Roskam wrote: > > Hi, > > > > Lately I have been using the "mutable namedtuple"

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Steven D'Aprano
On Thu, Apr 14, 2016 at 07:38:31PM +, Albert-Jan Roskam wrote: > Hi, > > Lately I have been using the "mutable namedtuple"  shown below a lot. > I found it somewhere on StackOverflow or ActiveState or something. In > its original form, it only had an __init__ method. I noticed that >