Oh and Risk,
I know I was calling the class object.
class 1 creates the instance object
class 2 tries to use the instance object
so the problem is how to make class 2 knowledgable of instance object? I guess
I could pass the instance object into the class, since class1 creates the
instance and
No offense taken. I'll get getting the Google Python Style Guide today. I'll
package up the code tonight and it to the group. Fortunately ( or
unfortunately), it is all in one file right now.
On Aug 2, 2010, at 10:31 PM, rantingrick wrote:
>
> Chris,
>
> It looks as if you are calling a cl
Chris,
It looks as if you are calling a class object and not an instance
object. However i cannot be for sure because you are using improper
Python style. All classes should be capwords. But here again you have
used camelcase for the class identifiers "radarWidgets" and
"mainDisplay", which is ba
What I am trying to do is call a class function from a menu, for example
displaySubMenu.add_radiobutton(label="Medium",
variable=radarPanelSize, command=radarWidgets.refresh)
class radarWidgets:
def __init__(self,root):
self.window = root
vsoler wrote:
I have the following script:
class TTT(object):
def duplica(self):
self.data *= 2
def __init__(self, data):
self.data = data
TTT.duplica(self.data)
def __str__(self):
return str(self.data)
print
obj=TTT(7)
print obj
And I want 14 printe
vsoler wrote:
I have the following script:
class TTT(object):
def duplica(self):
self.data *= 2
def __init__(self, data):
self.data = data
TTT.duplica(self.data)
def __str__(self):
return str(self.data)
print
obj=TTT(7)
print obj
And I want 14 printe
On Sat, 17 Apr 2010 15:44:56 +0200, Andreas Waldenburger wrote:
> On Sat, 17 Apr 2010 06:09:21 -0700 (PDT) vsoler
> wrote:
>
>> I got the following error:
>> TypeError: unbound method duplica() must be called with TTT instance as
>> first argument (got int instance instead)
>>
>> What am I doin
On Sat, 17 Apr 2010 15:44:56 +0200 Andreas Waldenburger
wrote:
> On Sat, 17 Apr 2010 06:09:21 -0700 (PDT) vsoler
> wrote:
>
> > I got the following error:
> > TypeError: unbound method duplica() must be called with TTT instance
> > as first argument (got int instance instead)
> >
> > What am I
On Sat, 17 Apr 2010 06:09:21 -0700 (PDT) vsoler
wrote:
> [snip actual question]
Oh and a note on vocabulary: A "class method" is a somewhat advanced
topic and quite probably not what you want here. They are not used very
often.
What I proposed in the other post was an "instance method", which i
On Sat, 17 Apr 2010 06:09:21 -0700 (PDT) vsoler
wrote:
> I got the following error:
> TypeError: unbound method duplica() must be called with TTT instance
> as first argument (got int instance instead)
>
> What am I doing wrong?
Not reading the error message.
You need to create a TTT instance
On Sat, Apr 17, 2010 at 11:09 PM, vsoler wrote:
> I have the following script:
>
> class TTT(object):
>def duplica(self):
>self.data *= 2
>def __init__(self, data):
>self.data = data
>TTT.duplica(self.data)
>
You're calling duplica with the class, and not by its o
I have the following script:
class TTT(object):
def duplica(self):
self.data *= 2
def __init__(self, data):
self.data = data
TTT.duplica(self.data)
def __str__(self):
return str(self.data)
print
obj=TTT(7)
print obj
And I want 14 printed (twice 7)
I g
Simon Percivall wrote:
> Read this: http://users.rcn.com/python/download/Descriptor.htm
>
> Long story short: The type of the instance is passed along together
> with the instance itself.
>
"Unlike static methods, class methods prepend the class reference to the
argument list before calling the
Read this: http://users.rcn.com/python/download/Descriptor.htm
Long story short: The type of the instance is passed along together
with the instance itself.
--
http://mail.python.org/mailman/listinfo/python-list
I'm reading about class methods now and I have a question about calling
them. I know it is wrong of me to assume it needs to work in a parallel
manner to an instance method, but I'm curious why it doesn't. Here's the
book's example:
class Multi:
def imeth(self, x):
print self, x
> Can anybody tell me how to call "f" in my C code?
Assuming you already have a handle to an instance of MyClass this should
do the trick:
PyObject *func = PyObject_GetAttrString(MyClassInst,"f");
if(func) {
PyObject *result = PyObject_CallObject(func,NULL);
if(result) {
//Do
Hi
I am trying to write a C code to call a class function in a python
module. Here's my python module:
def fib(n):# write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
def fib2(n): # return Fibonacci series up to n
result = []
a, b =
17 matches
Mail list logo