Question about Objects

Fernando Rodriguez frr at easyjob.net
Fri Nov 21 10:45:25 EST 2003


On Fri, 21 Nov 2003 09:56:07 -0500, "campbell95" <campbell95 at cox.net> wrote:

>This is what I get when I test it. Why does <getSomething> not return the
>value of <something>? is obvious that <something> has a value. I fear this
>is a simple oversight but I've racked my brain for hours looking at online

It is. ;-)

>doc's and examples. Thanks for any help!!
>
>>Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on
>win32
>>Type "copyright", "credits" or "license()" for more information.
>>****************************************************************
>>IDLE 1.0      ==== No Subprocess ====
>>>>>
>>>>> x = Test("Microsoft Sucks")
>>>>> x.getSomething
>><bound method Test.getSomething of <__main__.Test instance at 0x00C01940>>

Remember, this isn't VB: you can't leave the parens off when calling a method.
There's no difference between subs and functions in Python, and you must
include the parens if you want to _call_ the function and get the value.
Otherwise you get the function.

It makes sense, it just that you're used to the peculiar MS-way of doing
things. Your mind will heal, don't worry. ;-)





More information about the Python-list mailing list