[Tutor] Is it possible to tell, from which class an method was inherited from

2011-01-19 Thread Jojo Mwebaze
Is it possible to tell, from which class an method was inherited from. take an example below class A: def foo(): pass class B(A): def boo(A): pass class C(B): def coo() pass class D(C): def doo() pass >>> dir (D) ['__doc__', '__module__', 'boo', 'coo', 'doo', 'foo

Re: [Tutor] How to plot graph?

2011-01-19 Thread tee chwee liong
hi all, i installed matplotlib, numpy and scipy. i tried to run attached script to learn how it plot a grph but got error as below: Traceback (most recent call last): File "C:\Python25\myscript\plot\plot1.py", line 3, in from scipy import * File "C:\Python25\Lib\site-packages\scipy\

Re: [Tutor] Is it possible to tell, from which class an method was inherited from

2011-01-19 Thread Corey Richardson
On 01/19/2011 03:55 AM, Jojo Mwebaze wrote: > Is it possible to tell, from which class an method was inherited from. > take an example below > > |class A: > >def foo(): > pass > class B(A): > >def boo(A): > pass > > class C(B): >def coo() > > pass > class D(C): > >

Re: [Tutor] Is it possible to tell, from which class an method was inherited from

2011-01-19 Thread Peter Otten
Jojo Mwebaze wrote: > Is it possible to tell, from which class an method was inherited from. > take an example below > > class A: >def foo(): > pass > class B(A): >def boo(A): > pass > class C(B): >def coo() > pass > class D(C): >def doo() > pass > dir (

[Tutor] Decoding from strange symbols

2011-01-19 Thread Oleg Oltar
Hi, I am trying to decode a string I took from file: file = open ("./Downloads/lamp-post.csv", 'r') data = file.readlines() data[0] '\xff\xfeK\x00e\x00y\x00w\x00o\x00r\x00d\x00\t\x00C\x00o\x00m\x00p\x00e\x00t\x00i\x00t\x00i\x00o\x00n\x00\t\x00G\x00l\x00o\x00b\x00a\x00l\x00 \x00M\x00o\x00n\x00t\x

Re: [Tutor] Decoding from strange symbols

2011-01-19 Thread Peter Otten
Oleg Oltar wrote: > I am trying to decode a string I took from file: > > file = open ("./Downloads/lamp-post.csv", 'r') > data = file.readlines() > data[0] > > '\xff\xfeK\x00e\x00y\x00w\x00o\x00r\x00d\x00\t\x00C\x00o\x00m\x00p\x00e\x00t\x00i\x00t\x00i\x00o\x00n\x00\t\x00G\x00l\x00o\x00b\x00a\x0

Re: [Tutor] Decoding from strange symbols

2011-01-19 Thread Steven D'Aprano
Oleg Oltar wrote: Hi, I am trying to decode a string I took from file: [...] How do I convert this to something human readable? In general, you can't unless you know the encoding. A file filled with arbitrary bytes could be anything. However, you can sometimes guess the encoding, either b

Re: [Tutor] How to plot graph?

2011-01-19 Thread Steven D'Aprano
tee chwee liong wrote: hi all, i installed matplotlib, numpy and scipy. i tried to run attached script to learn how it plot a grph but got error as below: If you're having problems with numpy and scipy, you will probably get more help from a specialist numpy mailing list. -- Steven __

Re: [Tutor] Problems passing a parameter in a GUI

2011-01-19 Thread Alan Gauld
"David Holland" wrote This works :- def create_widgets(self): self.submit_bttn=Button(self, text="Submit", command=self.reveal) But when I changed it to use a number I get an error message. def create_widgets(self,x): x= self.submit_bttn=Button(self, text="Submit", command=sel

Re: [Tutor] Decoding from strange symbols

2011-01-19 Thread Alan Gauld
"Oleg Oltar" wrote I am trying to decode a string I took from file: file = open ("./Downloads/lamp-post.csv", 'r') I assume you know what its supposed to represent? What the columns etc are intended to be? Otherwise it will be a challenge! There is a section here that looks like the mon

Re: [Tutor] Why super does not work !

2011-01-19 Thread Alan Gauld
"Steven D'Aprano" wrote I'm sorry, but I don't believe you :/ If it "just works" in Lisp, why > does Lisp allow you to override the default linearization? At 2:00am last night I wrote a long explanatory reposte then discovered my wife's Netbook wouldn'ty let me post it! Now I can't be bothe

[Tutor] (no subject)

2011-01-19 Thread Jacob Bender
Dear tutors, I'm writing a program that can play Othello. Everything has been going fine, but there is a frequently occurring problem with printing the board with the squares filled in. Here's the code for the board: class board(object): def create_board(self): #Create a virtual board

Re: [Tutor] (no subject)

2011-01-19 Thread Emile van Sebille
On 1/19/2011 1:09 PM Jacob Bender said... def display_board(self): print self.board_table % self.board[:] Self.board is a list, but the formatting substitution needs to be passed a tuple. Try: print self.board_table % tuple(self.board) Emile ___

[Tutor] Correct Path for tkinter using python3.1 on Ubuntu Maverick!!

2011-01-19 Thread Nevins Duret
Hello Python Collective, Well, I'm sure this topic came up before on this forum, and I was confident that I mastered it having had to set it up correctly on my Mac systems and linux systems in the path. Here are my findings. I am trying to run this code: #!/usr/bin/env python3.1 from tkint

[Tutor] Battery Level Monitoring and Voice

2011-01-19 Thread FT
Hello everyone, Since I got a simple answer on the Python Win32 web site I decided to post it here for those who would want that information, especially those who can not see. The first 2 lines are all that is needed along with the battery level instances using that object, ( BatteryP

Re: [Tutor] OOP question

2011-01-19 Thread Nick Stinemates
If you want to test if one outcome is equal to another, you probably want to know if The name of the outcome is the same The odds of the outcome is the same So, you'd implement it like so class Outcome: def __eq__(self, other): if self.name == other.name and self.odds == other.odds:

Re: [Tutor] Problems passing a parameter in a GUI

2011-01-19 Thread David Holland
Dave, Sorry I did not include the traceback but now James Reynolds (thank you very much) has provided a solution I don't need the info any more. Thank you both for your help and time. Traceback (most recent call last):   File "/home/david/Documents/learnJava2010/v6c.py", line 46, in     app=Ap

Re: [Tutor] Tutor Digest, Vol 83, Issue 83

2011-01-19 Thread David Holland
I did understand the difference (it was me who did trying to write the program) however until James Reynolds provided me with the solution I could not think of a better way to do this. Thanks for the help. --- On Wed, 19/1/11, tutor-requ...@python.org wrote: --

Re: [Tutor] (no subject)

2011-01-19 Thread bob gailer
On 1/19/2011 4:09 PM, Jacob Bender wrote: Dear tutors, I'm writing a program that can play Othello. Everything has been going fine, but there is a frequently occurring problem with printing the board with the squares filled in. Here's the code for the board: Emile gave you the answer. A

Re: [Tutor] Tutor Digest, Vol 83, Issue 84

2011-01-19 Thread Jacob Bender
On 1/19/2011 4:53 PM, tutor-requ...@python.org wrote: Send Tutor mailing list submissions to tutor@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/tutor or, via email, send a message with subject or body 'help' to

Re: [Tutor] How to plot graph?

2011-01-19 Thread tee chwee liong
actually i just want to plot a simple x and y graph. any suggestion? how about using excel to plot? any sample code that i can follow to: 1) launch excel 2) read x-y from a text file 3) plot graph thanks > Date: Thu, 20 Jan 2011 01:20:53 +1100 > From: st...@pearwood.info > To: tutor@python.or

Re: [Tutor] How to plot graph?

2011-01-19 Thread David Hutto
actually i just want to plot a simple x and y graph. any suggestion? how about using excel to plot? any sample code that i can follow to: 1) launch excel 2) read x-y from a text file 3) plot graph thanks x,y is simple in many modules(beyond is more computational. What version of python, platform

Re: [Tutor] Is it possible to tell, from which class an method was inherited from

2011-01-19 Thread Jojo Mwebaze
Thanks guys for the responses, inspect.classify_class_attrs(klass) does the magic Regards On Wed, Jan 19, 2011 at 3:58 PM, Peter Otten <__pete...@web.de> wrote: > Jojo Mwebaze wrote: > > > Is it possible to tell, from which class an method was inherited from. > > take an example below > >