Determining method type given its string name presentation and its corresponding object reference.

2005-07-31 Thread Apple
Hi I am a bit new to python.  I was wondering if there is a way to
determine whether or not a given string is a member method of a given
object:

def is_a_method(self, attr_name):
   'returns True if attr_name is an instance method of self; false
otherwise'



The problem is that I have overridden __repr__ in such a way that it's
not self-contained. It makes a call to a member method, call it m(),
that would call up getattr() which eventually makes another call back
to __repr__:

Example output:
().


So, I want to trap all attr_name that are methods comeing into m() and
make sure they're not passed on to getatrr() i.e. making __repr__
self-contained (hopefully).

Is there a simple way to determine a given attr_name is_a_method()?
Thanks in advance for all your help.

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


Re: Determining method type given its string name presentation and itscorresponding object reference.

2005-07-31 Thread Apple
"or perhaps callable(getattr(obj, strg, None)) if the need is related
to
an unknown string which may be a callable attribute of an object whose
class is unknown ..."

Hm.. the problem is I cannot call getattr() at all.  Because getattr()
will call my __repr__() which will call another m() that will
eventually call getattr() again..  It's an infinite recursion.  In
general, I think every time you try to qualify a method attribute, e.g.
 obj.method, it'd actually end up making a call to __repr__()...

obj.method would usually get you this output:
 ()

More or less I am trying to understand what getattr did to figure out
the name "method" is actually a method (bounded or not).  This way I
can avoid the recursive call to __repr__().  I hope this clarifies my
question a bit?  

Thanks a lot for the help ;)

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


Help wanted in piping in Windows

2005-06-23 Thread Apple Grew
I want to develope a Winboard like application which will support 
Winboard protocol. For that I require to know how to handle piping in 
Python. I seperated out module popen2, but when I use 
fileObject.readline() then it halts the program if the sub-process is 
waiting for user input; will executing the readline() part in a seperate 
thread be helpful? My target platform is Windows.

Links to helpful web resources and sample Python codes will be highly 
appreciated.

Regards,
Apple
-- 
http://mail.python.org/mailman/listinfo/python-list


Help me to log-in

2005-06-23 Thread Apple Grew
Well can anyone tell me how do I login into newsgroup using Mozilla 
1.7.7. What should be the username? (I tried with with my e-mail address 
I subscribed with but failed to log-in). The password asked during 
log-in is the one I subscribed with?

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


Re: Boss wants me to program

2005-06-27 Thread Apple Grew
I think since speed is not such an issue (I heard that python can make 
faster GUI programs) you should use Visual Basic. It is  very well 
suited for Windows programming. There is the good thing that you can 
visually create the GUI hence it is easier to create the GUI.

[EMAIL PROTECTED] wrote:

>I'm a manager where I work(one of the cogs in a food service company).
>The boss needed one of us to become the "tech guy", and part of that is
>writing small windows programs for the office. He wants the development
>work done in house, and he knows I am in school for a CS minor. I know
>basic C++(Part 2 of that is in the fall), and I will be taking Java 1
>in the fall also. What is the easiest way for me to make windows
>programs that will do basic things like(Inventory, Menu Management,
>etc...)? I have heard visual basic is where it's at. I want to keep an
>open mind though, so I am wondering if python could be an option. The
>programs have
>no speed requirement.  But they must be pretty, and not confuse my
>boss. Plus he wants well documented help for each function. I asked the
>windows programming group, but I thought I would ask here also. Thanks.
>
>Xeys
>
>  
>
-- 
http://mail.python.org/mailman/listinfo/python-list