On Wed, 14 Aug 2013 14:16:31 +, climb65 wrote:
Hello,
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in
a class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++ it is possible.
I agree with Steven here.
classmethod is the best practise, most practical, readable, future-proof,
one obvious way to do it.
On 15 Aug 2013 08:29, Steven D'Aprano st...@pearwood.info wrote:
On Wed, 14 Aug 2013 14:16:31 +, climb65 wrote:
Hello,
here is a small basic question :
Is
In article 520c81f6$0$29885$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano st...@pearwood.info wrote:
[1] The constructor is __new__, not __init__. __init__ is called to
initialise the instance after __new__ constructs it.
True, but be warned that writing your own __new__() is quite
Hello,
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in a
class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++ it is possible.
Thanks for your answer.
--
2013/8/14 climb65 clim...@laposte.net
Hello,
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in a
class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++ it is possible.
Thanks for
On 14/08/13 15:16, climb65 wrote:
Hello,
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in a
class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++ it is possible.
Thanks for your
On Wed, Aug 14, 2013 at 10:16 AM, climb65 clim...@laposte.net wrote:
Hello,
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in a
class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++