Re: Sub-classing unicode: getting the unicode value

2007-12-31 Thread Martin v. Löwis
>>> How does my object get its own value? >> def __unicode__(self): >> return unicode(self) > > I get an endless recursion with this. I see. That worked fine in Python 2.4, but give a stack overflow in Python 2.5. Depending on your exact class definition, something like return supe

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Torsten Bronger
Hallöchen! John Machin writes: > On Dec 31, 8:08 am, Torsten Bronger <[EMAIL PROTECTED]> > wrote: > >> [...] >> >> But then it is not unicode but Excerpt which I don't want. The >> idea is to buffer the unicode representation in order to gain >> efficiency. Otherwise, a lot of unicode conversio

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Torsten Bronger
Hallöchen! Martin v. Löwis writes: >> How does my object get its own value? > > def __unicode__(self): > return unicode(self) I get an endless recursion with this. I must admit, though, that I probably overestimate the costs connected with unicode(my_excerpt) because Gabriel is probably r

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread John Machin
On Dec 31, 8:08 am, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > Gabriel Genellina writes: > > On 30 dic, 17:25, Torsten Bronger <[EMAIL PROTECTED]> > > wrote: > > >> I sub-classed unicode in an own class called "Excerpt", and now I > >> try to implement a __unicode__ method. In thi

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Martin v. Löwis
> How does my object get its own value? def __unicode__(self): return unicode(self) Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Torsten Bronger
Hallöchen! Gabriel Genellina writes: > On 30 dic, 19:08, Torsten Bronger <[EMAIL PROTECTED]> > wrote: > >> [...] >> >> But then it is not unicode but Excerpt which I don't want.  The >> idea is to buffer the unicode representation in order to gain >> efficiency. Otherwise, a lot of unicode conve

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Gabriel Genellina
On 30 dic, 19:08, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Gabriel Genellina writes: > > On 30 dic, 17:25, Torsten Bronger <[EMAIL PROTECTED]> > > wrote: > > >> I sub-classed unicode in an own class called "Excerpt", and now I > >> try to implement a __unicode__ method.  In this method, I want

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Torsten Bronger
Hallöchen! Gabriel Genellina writes: > On 30 dic, 17:25, Torsten Bronger <[EMAIL PROTECTED]> > wrote: > >> I sub-classed unicode in an own class called "Excerpt", and now I >> try to implement a __unicode__ method.  In this method, I want to >> get the actual value of the instance, i.e. the unico

Re: Sub-classing unicode: getting the unicode value

2007-12-30 Thread Gabriel Genellina
On 30 dic, 17:25, Torsten Bronger <[EMAIL PROTECTED]> wrote: > I sub-classed unicode in an own class called "Excerpt", and now I > try to implement a __unicode__ method.  In this method, I want to > get the actual value of the instance, i.e. the unicode string: The "actual value of the instance",