Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-10 Thread Stephen J. Turnbull
Chris Angelico writes: The justification is illogical. However, I personally believe boilerplate should be omitted where possible; But it mostly can't be omitted. I wrote 22 classes (all trivial) yesterday for a Python 3 program. Not one derived directly from object. That's a bit unusual,

Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-10 Thread Alexander Belopolsky
On Sat, Aug 9, 2014 at 8:44 PM, Steven D'Aprano st...@pearwood.info wrote: It is certainly required when writing code that will behave the same in version 2 and 3 This is not true. An alternative is to put __metaclass__ = type at the top of your module to make all classes in your module

Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-10 Thread Barry Warsaw
On Aug 10, 2014, at 11:51 AM, Alexander Belopolsky wrote: This is not true. An alternative is to put __metaclass__ = type at the top of your module to make all classes in your module new-style in python2. I like this much better, and it's what I do in my own bilingual code. It makes it much

Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-10 Thread Steven D'Aprano
On Sun, Aug 10, 2014 at 11:51:51AM -0400, Alexander Belopolsky wrote: On Sat, Aug 9, 2014 at 8:44 PM, Steven D'Aprano st...@pearwood.info wrote: It is certainly required when writing code that will behave the same in version 2 and 3 This is not true. An alternative is to put

[Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-09 Thread John Yeuk Hon Wong
Hi. Referring to my discussion on [1] and then on #python this afternoon. A little background would help people to understand where this was coming from. 1. I write Python 2 code and have done zero Python-3 specific code. 2. I have always been using class Foo(object) so I do not know the new

Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-09 Thread Terry Reedy
On 8/9/2014 2:44 PM, John Yeuk Hon Wong wrote: Hi. Referring to my discussion on [1] and then on #python this afternoon. A little background would help people to understand where this was coming from. 1. I write Python 2 code and have done zero Python-3 specific code. 2. I have always been

Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-09 Thread Steven D'Aprano
On Sat, Aug 09, 2014 at 02:44:10PM -0400, John Yeuk Hon Wong wrote: Hi. Referring to my discussion on [1] and then on #python this afternoon. A little background would help people to understand where this was coming from. 1. I write Python 2 code and have done zero Python-3 specific

Re: [Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

2014-08-09 Thread Chris Angelico
On Sun, Aug 10, 2014 at 10:44 AM, Steven D'Aprano st...@pearwood.info wrote: Looking at your comment here: [1]: https://news.ycombinator.com/item?id=8154471 there is a reply from zeckalpha, who says: Actually, leaving out `object` is the preferred convention for Python 3, as they