problem in the compiler ?

Scott David Daniels Scott.Daniels at Acm.Org
Tue May 3 10:21:31 EDT 2005


Glauco Silva wrote:
> python : 2.3.5
> os: win 2K
This part is good enough (though sometimes it helps to mention the 
service pack number
on windows systems).

> My code is like this:
> 
> MyClass()
> 
> class MyClass:
>      def __init__(self):
>          btn = RadioButton(command=self.Function)
>      def Function(self):
>          print "Enter in the function"

This is not good enough.  Show us a small actual example that exhibits
the problem behavior on your machine.  Often in the course of doing this
distillation, the original problem will become clear to you.  The code
above fails with:

Traceback (most recent call last):
   File "<pyshell#0>", line 1, in -toplevel-
     MyClass()
NameError: name 'MyClass' is not defined

on the initial call to MyClass().  I suspect this is not what you care
about.

Don't make people trying to help you do any work you cannot do yourself.
Imagine yourself browsing the newsgroup and trying to decide whether to
spend some time trying to help someone with a problem.  Would _you_ want
to spend time trying to guess what the code was with the problem as well
as what the problem was, or would you decide to help someone else out?

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list