2021-08-25 19:46:57 +02:00
|
|
|
# pseudocode for object construction
|
2021-02-15 00:58:46 +01:00
|
|
|
def make(the_class, some_arg):
|
|
|
|
new_object = the_class.__new__(some_arg)
|
|
|
|
if isinstance(new_object, the_class):
|
|
|
|
the_class.__init__(new_object, some_arg)
|
|
|
|
return new_object
|
|
|
|
|
|
|
|
# the following statements are roughly equivalent
|
|
|
|
x = Foo('bar')
|
|
|
|
x = make(Foo, 'bar')
|