Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-28 Thread Michael Lohmann
> I'd say NOT wanting to call an __init__ method of a superclass is a > rather uncommon occurence. It's generally a huge error. So I think > it's worth not accomodating that. I will give you an example then where I am absolutely fine with calling super().__init__ in all classes and describe why

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-28 Thread Michael Lohmann
>>class Magic: >>magic_number = 42 >>def __init__(self): >>A.magic_number = 0 # As soon as you look too deep into it all >> the Magic vanishes > > What is A here? Did you mean something else? Sorry for that. Yes, it should have been Magic (I renamed the class af

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-27 Thread Michael Lohmann
> Everything my idea has to offer really is just reasonable if you don’t have > single inheritance only I would like to correct myself immediately on that one: In the Pizza-example (from yesterday as well) it would be possible to overwrite the default price of the HawaiianPizza with the mergin

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-27 Thread Michael Lohmann
I realized that bypassing kwargs is probably the least important thing of this idea - so if implemented it definitely had to get a better name. Just look at the following example: class Magic: magic_number = 42 def __init__(self): A.magic_number = 0 # As soon as

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-27 Thread Michael Lohmann
> If I understand correctly, the essence of your argument seems to be > that you want be able to write a class A, and you want to be able to use that > class EITHER as the top of an inheritance chain (i.e., have it inherit > directly from object) OR in the middle of an inheritance chain (

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-26 Thread Michael Lohmann
> Right, which means that Pizza and Lasagna are not compatible classes > in that way. Okay, let me try it one final time with the original pizza example. Let’s assume that your restaurant has a special offer on all Hawaiian Pizzas where you can get all sizes for 10$. Now the only reasonable thi

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-26 Thread Michael Lohmann
Let me put it this way: class A(object): def __init__(self, a_value, **kwargs): print("This is a value:", a_value) super().__init__(**kwargs) Which parameters does `A` take when being initialized? Whenever you give any kwargs when directly instantiating `A` they

Re: [Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-26 Thread Michael Lohmann
[Steven D'Aprano] >obj = Aardvark(27, spam=3, eggs=5, cheese=True) > > So you look up help(Aardvark), and it tells you that the signature is > >Aardvark.__init__(self, foo) > > What the hell? If Aardvark.__init__ only takes a single argument This is wrong! This would at some point down t

[Python-ideas] Keyword for direct pass through of kwargs to super

2018-05-25 Thread Michael Lohmann
Hi! ***Disclaimer: I am relatively new to Python*** I propose to add some mechanism that can automatically collect everything what would normally be collected by **kwargs in the __init__ method and directly pass it through to the super().__init__ call without being accessible in the __init__ itse