Re: [Tutor] MutableString/Class variables

2013-05-10 Thread Albert-Jan Roskam
> From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Friday, May 10, 2013 1:28 PM > Subject: Re: [Tutor] MutableString/Class variables > > On 09/05/13 22:10, Albert-Jan Roskam wrote: >> Hello, >> >> I was just playing a bit with

Re: [Tutor] MutableString/Class variables

2013-05-10 Thread Steven D'Aprano
On 09/05/13 22:10, Albert-Jan Roskam wrote: Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the way to do this? Guido's time machine strikes again: py> from UserString import MutableString py> s = MutableStri

Re: [Tutor] MutableString/Class variables

2013-05-10 Thread Albert-Jan Roskam
>Subject: Re: [Tutor] MutableString/Class variables >On 05/09/2013 09:16 AM, Albert-Jan Roskam wrote: >>> On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: >>>>   Hello, >>>> >>>>   I was just playing a bit with Python and I wanted to make a mut

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Dave Angel
On 05/09/2013 09:16 AM, Albert-Jan Roskam wrote: Subject: Re: [Tutor] MutableString/Class variables On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Oscar Benjamin
On 9 May 2013 14:16, Albert-Jan Roskam wrote: > > >> Subject: Re: [Tutor] MutableString/Class variables >> >> On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: >>> Hello, >>> >>> I was just playing a bit with Python and I wanted to make a mutab

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] MutableString/Class variables > > On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: >> Hello, >> >> I was just playing a bit with Python and I wanted to make a mutable string, > that supports item assignment. Is the way below the way to

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Dave Angel
On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the way to do this? The part I am not sure about is the class variable. Maybe I should also have reimplemented __i

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Alan Gauld
On 09/05/13 13:10, Albert-Jan Roskam wrote: class MutableStr(str): s = None Why make s a class variable? I'd expect it to be an instance attribute. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist

[Tutor] MutableString/Class variables

2013-05-09 Thread Albert-Jan Roskam
Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the way to do this?  The part I am not sure about is the class variable. Maybe I should also have reimplemented __init__, then call super inside this and add an upda