Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-28 Thread Alex Walters
At this point, I would punt to distutils-sig about curated packages, and pip tooling to support that, but they are bogged down as it stands with just getting warehouse up and running. I don’t support putting specialized tooling in python itself to install curated packages, because that

Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-28 Thread Guido van Rossum
Why? What's wrong with pip install? Why complicate things? Your motivation is really weak here. "beneficial"? "difficult cases"? On Sat, Oct 28, 2017 at 8:57 PM, Nick Coghlan wrote: > Over on python-dev, the question of recommending MRAB's "regex" module > over the standard

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Nick Coghlan
On 29 October 2017 at 12:25, Brendan Barnwell wrote: > On 2017-10-28 19:13, Soni L. wrote: > >> And to have all cars have engines, you'd do: >> >> class Car: >> def __init__(self, ???): >> self[Engine] = GasEngine() >> >> car = Car() >> car[Engine].kickstart() #

[Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-28 Thread Nick Coghlan
Over on python-dev, the question of recommending MRAB's "regex" module over the standard library's "re" module for more advanced regular expressions recently came up again. Because of various logistical issues and backwards compatibility risks, it's highly unlikely that we'll ever be able to swap

Re: [Python-ideas] Dollar operator suggestion

2017-10-28 Thread Koos Zevenhoven
On Fri, Oct 27, 2017 at 8:46 AM, Mike Müller wrote: > This already exists in Coconut: > http://coconut.readthedocs.io/en/master/HELP.html#function-composition > > Quite funny to read that. It seems like they have made something like what I proposed in the 2015

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Brendan Barnwell
On 2017-10-28 19:13, Soni L. wrote: Hmm thinking about it some more, this whole "magic()" thing is still bad. Replace class Car with: class Car: pass # or something like that and use it as: car = Car() car[Engine] = GasEngine() # please use the actual type instead of a stringy type for

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:05 PM, Soni L. wrote: > And how do you make the object creation so cheap to the point where it's > actually practical? (quick question: does Python use a single opcode and an > optimized codepath for method calls, or does it always create a method >

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Soni L.
On 2017-10-29 12:05 AM, Soni L. wrote: On 2017-10-28 11:57 PM, Chris Angelico wrote: On Sun, Oct 29, 2017 at 12:46 PM, Soni L. wrote: But you should be able to do things like car = object() car[Engine] = SimpleEngine() car.[Engine].kickstart() # calls kickstart

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Soni L.
On 2017-10-28 11:57 PM, Chris Angelico wrote: On Sun, Oct 29, 2017 at 12:46 PM, Soni L. wrote: But you should be able to do things like car = object() car[Engine] = SimpleEngine() car.[Engine].kickstart() # calls kickstart method with an instance of SimpleEngine as

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 12:46 PM, Soni L. wrote: > But you should be able to do things like > > car = object() > car[Engine] = SimpleEngine() > car.[Engine].kickstart() # calls kickstart method with an instance of > SimpleEngine as `self`/first argument and `car` as second

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Soni L.
On 2017-10-28 11:31 PM, Koos Zevenhoven wrote: On Sat, Oct 28, 2017 at 11:24 PM, Soni L. >wrote: On 2017-10-28 02:51 PM, Steven D'Aprano wrote: You ignored my question: Is that the sort of thing you mean by

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Koos Zevenhoven
On Sat, Oct 28, 2017 at 11:24 PM, Soni L. wrote: > > On 2017-10-28 02:51 PM, Steven D'Aprano wrote: > >> >> You ignored my question: Is that the sort of thing you mean by >> composition? If not, then what do you mean by it? This is not a >> rhetorical question: I'm having

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Soni L.
On 2017-10-28 02:51 PM, Steven D'Aprano wrote: On Sat, Oct 28, 2017 at 10:19:09AM -0200, Soni L. wrote: class Car: def __init__(self): self.engine = Engine() self.accelerator = AcceleratorPedal() ... def start(self): # Delegate to the ignition

Re: [Python-ideas] Thread.__init__ should call super()

2017-10-28 Thread Antoine Pitrou
On Fri, 27 Oct 2017 13:59:01 -0700 Ilya Kulakov wrote: > Since one of the legit use-cases of using the Thread class is subclassing, > I think it's __init__ should call super() to support cooperative inheritance. Not to derail this thread, but I find it much clearer to use

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Steven D'Aprano
On Sat, Oct 28, 2017 at 10:19:09AM -0200, Soni L. wrote: > >class Car: > > def __init__(self): > > self.engine = Engine() > > self.accelerator = AcceleratorPedal() > > ... > > > > def start(self): > > # Delegate to the ignition component. > >

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Thomas Jollans
On 28/10/17 14:19, Soni L. wrote: > > > On 2017-10-28 09:51 AM, Steven D'Aprano wrote: >> On Sat, Oct 28, 2017 at 09:09:30AM -0200, Soni L. wrote: >>> As recent threads indicate, composition may sometimes be better than >>> inheritance. And so I'd like to propose composition as a built-in >>>

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Soni L.
On 2017-10-28 09:51 AM, Steven D'Aprano wrote: On Sat, Oct 28, 2017 at 09:09:30AM -0200, Soni L. wrote: As recent threads indicate, composition may sometimes be better than inheritance. And so I'd like to propose composition as a built-in feature. My idea is syntax of the form o.[c].m(),

Re: [Python-ideas] Thread.__init__ should call super()

2017-10-28 Thread Neil Girdhar
On Sat, Oct 28, 2017 at 7:15 AM Steven D'Aprano wrote: > On Sat, Oct 28, 2017 at 12:14:31AM -0700, Neil Girdhar wrote: > > > > > > On Friday, October 27, 2017 at 8:05:17 PM UTC-4, Steven D'Aprano wrote: > > > > > > On Fri, Oct 27, 2017 at 01:59:01PM -0700, Ilya Kulakov

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Steven D'Aprano
On Sat, Oct 28, 2017 at 09:09:30AM -0200, Soni L. wrote: > As recent threads indicate, composition may sometimes be better than > inheritance. And so I'd like to propose composition as a built-in feature. > > My idea is syntax of the form o.[c].m(), where o is an object, c is a > component, m

Re: [Python-ideas] Thread.__init__ should call super()

2017-10-28 Thread Steven D'Aprano
On Sat, Oct 28, 2017 at 12:14:31AM -0700, Neil Girdhar wrote: > > > On Friday, October 27, 2017 at 8:05:17 PM UTC-4, Steven D'Aprano wrote: > > > > On Fri, Oct 27, 2017 at 01:59:01PM -0700, Ilya Kulakov wrote: > > > > > Since one of the legit use-cases of using the Thread class is > >

[Python-ideas] Composition over Inheritance

2017-10-28 Thread Soni L.
As recent threads indicate, composition may sometimes be better than inheritance. And so I'd like to propose composition as a built-in feature. My idea is syntax of the form o.[c].m(), where o is an object, c is a component, m is a method. I am not sure how you'd set components, or test for

Re: [Python-ideas] Thread.__init__ should call super()

2017-10-28 Thread Neil Girdhar
I meant: class SomeBase: def __init__(self, base_x, **kwargs): super().__init__(**kwargs) self.base_x = base_x On Saturday, October 28, 2017 at 3:14:31 AM UTC-4, Neil Girdhar wrote: > > > > On Friday, October 27, 2017 at 8:05:17 PM UTC-4, Steven D'Aprano wrote: >> >> On Fri,

Re: [Python-ideas] Thread.__init__ should call super()

2017-10-28 Thread Neil Girdhar
On Friday, October 27, 2017 at 8:05:17 PM UTC-4, Steven D'Aprano wrote: > > On Fri, Oct 27, 2017 at 01:59:01PM -0700, Ilya Kulakov wrote: > > > Since one of the legit use-cases of using the Thread class is > subclassing, > > I think it's __init__ should call super() to support cooperative >

Re: [Python-ideas] Thread.__init__ should call super()

2017-10-28 Thread Neil Girdhar
Out of curiosity, what is the benefit of not calling super from Thread.__init__? On Friday, October 27, 2017 at 7:29:17 PM UTC-4, Guido van Rossum wrote: > > You can subclass Thread just fine, you just can't have it in a multiple > inheritance hierarchy except at the end of the MRO (before