Huh... that is weird. Maybe I misinterpreted __new__/__init__
documentation, and I guess I never did really test it out.
So I'm guessing my use of _init in __new__ can be replaced by __init__,
and all will be well... but now I want to know what the real story is
too, so I'll have to look at the Python docs again.
On Thu, 2003-05-22 at 11:40, Bud P.Bruegger wrote:
> On Thu, 22 May 2003 11:02:36 -0500
> Luke Opperman <lu...@me...> wrote:
>
> > See above, it's impossible in python to call __new__ and avoid __init__ to my
> > knowledge.
>
> While I'm surely not a Python wizzard, this kind of surprises me. So I
> ran a little test:
>
> #-------------------------------------------------
> #!/usr/local/bin/python
>
> class C(object):
> def __init__(self):
> self.bud="was here"
>
> c1 = C()
> print c1.bud
> c2 = C.__new__(C)
> try:
> print c2.bud
> except:
> print "c2 has no attribute 'bud'"
> #-------------------------------------------------
>
> That produces the following output:
>
> #-------------------------------------------------
> was here
> c2 has no attribute 'bud'
> #-------------------------------------------------
>
>
> So I don't think __init__ ran in any way!
>
> Also, if __init__ was to run implicitly, where would it get the
> parameters from? I avoided parameters other than self above, but this
> seems weird to me...
>
> --b
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ObjectStore.
> If flattening out C++ or Java code to make your application fit in a
> relational database is painful, don't do it! Check out ObjectStore.
> Now part of Progress Software. http://www.objectstore.net/sourceforge
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
|