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
|