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
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
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() #
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
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
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
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
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
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
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
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
>
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
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
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.
> >
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
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(),
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
>>>
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
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
> >
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
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
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 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,
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
24 matches
Mail list logo