On 15 avr, 17:27, Reckoner <[EMAIL PROTECTED]> wrote:
> would it be possible to use one of an object's methods without
> initializing the object?
>
> In other words, if I have:
>
> class Test:
>   def __init__(self):
>       print 'init'
>   def foo(self):
>       print 'foo'
>
> and I want to use the foo function without hitting the
> initialize constructor function.
>
> Is this possible?

Yes:

In [214]: class Test:
   .....:     def foo(self):
   .....:         print 'foo'
   .....:

In [215]: t = Test()

In [216]: t.foo()
foo

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to