On Wed, Mar 2, 2016 at 10:57 AM, Rob Gaddi
<rgaddi@highlandtechnology.invalid> wrote:
> Peter Pearson wrote:
>
>> On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote:
>>>
>>> It's not clear to me what arguments are passed to the
>>> __new__ method. Here i
Peter Pearson wrote:
> On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote:
>>
>> It's not clear to me what arguments are passed to the
>> __new__ method. Here is a piece of code:
>>
>>
>> class Premiere:
>>
>> def __new__(cls, price):
>>
On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote:
>
> It's not clear to me what arguments are passed to the
> __new__ method. Here is a piece of code:
>
>
> class Premiere:
>
> def __new__(cls, price):
> return object.__new__(cls)
>
> def __init__
On Wed, 2 Mar 2016 08:23 pm, ast wrote:
> An other question:
>
> What is the very first method launched when an instantiation is done ?
> e.g obj = MyClass(0, 5, 'xyz')
>
> is it __call__ (from object or MyClass if overriden) ?
No, not object or MyClass. The *metaclass* __call__ is called.
"ast" a écrit dans le message de
news:56d5d043$0$632$426a7...@news.free.fr...
ty for the détailed explanations.
An other question:
What is the very first method launched when an instantiation is done ?
e.g obj = MyClass(0, 5, 'xyz')
is it __call__ (from object or
On Tue, Mar 1, 2016 at 2:27 PM, Terry Reedy wrote:
> On 3/1/2016 12:24 PM, ast wrote:
>
>> class Premiere:
>> def __init__(self, price):
>> pass
>> p = Premiere(1000)
>>
>> which is OK.
>
> Premiere is callable because it inherits object.__call__. That function, or
On 3/1/2016 12:24 PM, ast wrote:
Hello
It's not clear to me what arguments are passed to the
__new__ method.
The objects passed to any function are the objects that are passed. The
type and number of objects that *should be* passed depends on the
signature of the function.
If class C
On Tue, Mar 1, 2016 at 11:24 AM, ast wrote:
>
> class Premiere:
>
>def __new__(cls, price):
>return object.__new__(cls, price)
>
>def __init__(self, price):
>pass
>
> p = Premiere(1000)
>
> it fails. It is strange because according to me it is
Hello
It's not clear to me what arguments are passed to the
__new__ method. Here is a piece of code:
class Premiere:
def __new__(cls, price):
return object.__new__(cls)
def __init__(self, price):
pass
p = Premiere(1000)
No errors, so it seems that 2 arguments