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

2017-10-28 Thread Stephan Houben
There are already curated lists of Python packages, such as: https://github.com/vinta/awesome-python Even better, if you don't agree, you can just clone it and create your own ;-) Stephan 2017-10-29 6:46 GMT+01:00 Alex Walters : > At this point, I would punt to distutils-sig about curated pack

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 curation

Re: [Python-ideas] Composition over Inheritance

2017-10-28 Thread Greg Ewing
My take on all this is that it's much simpler just to give the engine an attribute that refers back to the car. The only downside is that it creates a circular reference, but in these days of cyclic gc, that's not much of an issue. -- Greg ___ Python-i

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 library's "re" module

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() # kickstart gets the car a

[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 function composition threads, but wi

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 th

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 > wrapper, even for imme

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 method with an instance of

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 `self`/first argument and

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 argument. > # etc > > Wh

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 composition? If not, then what do y

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 difficulty understanding

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 co

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 the functional form of t

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. > > self.ig

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 >>> fea

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(), wher

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 wrote: > > > > > > > Since

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 is

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 > > subclassi

[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 c

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 > i

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 objec