Re: [Tutor] class decorator question

2013-10-06 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Sunday, October 6, 2013 4:52 AM > Subject: Re: [Tutor] class decorator question > > On Sat, Oct 05, 2013 at 12:26:14PM -0700, Albert-Jan Roskam wrote: > >> >

Re: [Tutor] class decorator question

2013-10-06 Thread Mark Lawrence
On 06/10/2013 03:58, Steven D'Aprano wrote: On Sun, Oct 06, 2013 at 01:06:18AM +0100, Alan Gauld wrote: On 05/10/13 20:26, Albert-Jan Roskam wrote: General question: I am using pastebin now. Is that okay, For code as short as this it's probably best kept with the message. But once you get to

Re: [Tutor] class decorator question

2013-10-05 Thread Steven D'Aprano
On Sun, Oct 06, 2013 at 01:06:18AM +0100, Alan Gauld wrote: > On 05/10/13 20:26, Albert-Jan Roskam wrote: > > >General question: I am using pastebin now. Is that okay, > > For code as short as this it's probably best kept with the message. > But once you get to 100+ lines its more debatable and i

Re: [Tutor] class decorator question

2013-10-05 Thread Steven D'Aprano
On Sat, Oct 05, 2013 at 12:26:14PM -0700, Albert-Jan Roskam wrote: > >> On http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ I saw > >> a very cool and useful example of a class decorator. It (re)implements > >> __str__ and __unicode__ in case Python 2 is used. For Python 3, the > >>

Re: [Tutor] class decorator question

2013-10-05 Thread Alan Gauld
On 05/10/13 20:26, Albert-Jan Roskam wrote: General question: I am using pastebin now. Is that okay, For code as short as this it's probably best kept with the message. But once you get to 100+ lines its more debatable and if you get to 200+ lines I'd definitely say a pastebin is better. fro

Re: [Tutor] class decorator question

2013-10-05 Thread Albert-Jan Roskam
___ > From: Steven D'Aprano >To: tutor@python.org >Sent: Saturday, October 5, 2013 3:14 PM >Subject: Re: [Tutor] class decorator question > >On Sat, Oct 05, 2013 at 05:33:46AM -0700, Albert-Jan Roskam wrote: >> Hi, >> >> On

Re: [Tutor] class decorator question

2013-10-05 Thread Steven D'Aprano
On Sat, Oct 05, 2013 at 05:33:46AM -0700, Albert-Jan Roskam wrote: > Hi, > > On http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ I saw > a very cool and useful example of a class decorator. It (re)implements > __str__ and __unicode__ in case Python 2 is used. For Python 3, the > dec

[Tutor] class decorator question

2013-10-05 Thread Albert-Jan Roskam
Hi, On http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ I saw a very cool and useful example of a class decorator. It (re)implements __str__ and __unicode__ in case Python 2 is used. For Python 3, the decorator does nothing. I wanted to generalize this decorator so the __str__ metho