Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-14 Thread bob gailer
Dick Moores wrote: At 08:58 PM 8/13/2008, bob gailer wrote: One thing I really like about Python Win is the integrated debugger, which takes no time to start up. SPE OTOH uses WinPDB which runs as a separate process that takes (in the demo video) 15 seconds to start (each time it is requested

Re: [Tutor] For Loops and nested loops

2008-08-16 Thread bob gailer
would find your questions and comments easier to read if you divided sentences with capitalization and punctuation. Be sure to reply-all. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others.

Re: [Tutor] simple python scrip for collocation discovery

2008-08-16 Thread bob gailer
Word line = infile.readline().split() # rest of your code follows starting with # chi2 = ... # If you want to get even "sexier" you could create an array of counters # counters = [[0,0],[0,0]] # where the elements left to right represent o22, o12, o21 and o11 # taking advantage of the fac

Re: [Tutor] For Loops and nested loops

2008-08-16 Thread bob gailer
PLEASE REPLY TO THE GROUP NOT JUST ME. Did you miss my request for that (reply-all)? Umesh Singhal wrote: Hi Bob, unfortunately when i pasted in the code it seems to have gone wrong this is how it is at the moment with the correct indentation for the nested loop: code: a=raw_input

Re: [Tutor] Gaussian function

2008-08-17 Thread bob gailer
ot; in the example shown the number of asterisks is 50 * gauss(x). Should I start with a program like this? s='' for n in range (0,100): s=s+ '*' print s Thanks for any help received. :confused: -- Bob Gailer Chapel Hill NC 919-636-4239 When we take

[Tutor] How to use urllib2.https_open with SSL support in Windows XP for python 2.5.2]

2008-08-18 Thread bob gailer
Forwarding to the list. Please always reply to the list. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and

[Tutor] [Fwd: FW: Gaussian function]

2008-08-18 Thread bob gailer
come from? If you assume xmin = -2.5 then it will work. How in Python can you express this series (for loop?) What class is this question from? Have you met the prerequisites for the class? If so why is the instructor expecting you to do something he has not prepared you for? -- Bob Gailer

Re: [Tutor] Gaussian function

2008-08-18 Thread bob gailer
t is too complex for your current understanding of Python! -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trai

Re: [Tutor] programming tic tac toe

2008-08-21 Thread bob gailer
inner(): print "winner" break else: print "no winner" # Mark row 1 all X for cell in rows[1].cells: cell.player = 'X' for line in lines: if line.winner(): print "winner" bresk else: print "no winner" -- Bob Gailer Chapel Hill NC 919

Re: [Tutor] Adding Lists?

2008-08-23 Thread bob gailer
duce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates 1+2)+3)+4)+5) (the sum) -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this aware

Re: [Tutor] dynamic argument lists

2008-08-29 Thread Bob Gailer
"] > > arg2 = [1,2,3,4] > > arg3 = dict(zip(arg1,arg2)) > > myfunc(arg3) > myfunc(**arg3) Let's back up to arg_str = "a=1, b=2, c=3, d=4" To create a dictionary from that: argDict = dict(pair.split('=') fo

Re: [Tutor] dynamic argument lists

2008-08-30 Thread bob gailer
eShopping wrote: Bob, Kent thanks for the suggestions. Bob made the comment "If there is no compelling requirement that myfunc's argument be in the form **kwargs ...", but I'm afraid I don't understand the difference between myfunc (**kwargs) and myfunc (kw

Re: [Tutor] Having trouble with a component of the random module

2008-08-31 Thread bob gailer
ng without replacement. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in learning this proc

Re: [Tutor] Concatenation vs formatting

2008-09-01 Thread bob gailer
her. I almost always favor formatting as it is so much easier to read, maintain and extend. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this a

Re: [Tutor] Releasing a File for Access

2008-09-11 Thread bob gailer
) # copy rest of file - assuming file is not BIG     output_file.close()     input_file.close()     print "modified txt file with event info"     # now copy tmp back to ...     return -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have

Re: [Tutor] Hey Variables

2008-09-12 Thread Bob Gailer
On Fri, Sep 12, 2008 at 1:51 PM, Jeremiah Stack <[EMAIL PROTECTED]> wrote: > I was wondering If you could help me out. > > I am trying to set a variable for the number of variables. ? > > Any help would be awesome > More details would be wonderful. I have no idea of w

Re: [Tutor] Validation loop

2008-09-13 Thread bob gailer
ython.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and t

Re: [Tutor] Miles Per Gallon Calculator`

2008-09-18 Thread bob gailer
gt;> print a/b Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for /: 'str' and 'int' -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying i

Re: [Tutor] How to print complex numbers without enclosing parentheses

2008-09-19 Thread bob gailer
tr__(self): ...         return "%s-%sj" % (self.real, self.imag) ...     def __init__(self, r, i): ...         complex.__init__(self, r, i) ... >>> c=C(1,2) >>> c (1+2j) >>> print c '1.0-2.0j'; This might seem clunky but this is the way to alter behavior of b

Re: [Tutor] Operators on complex numbers, and applying real to a list of real and complex numbers

2008-09-19 Thread bob gailer
ould simply take the list comprehension [real(lx) for lx in ll] Is this worthy of a PEP? FWIW I'd like to see all numbers have real and imag attributes. Regarding "worthiness" - the language grows as suggestions are offered. I'd say write and submit one. It seems simpl

Re: [Tutor] Reading Files and Such

2008-09-29 Thread bob gailer
e are many ways to get and filter directory contents. I guess you would benefit from the glob module. import glob fileList = glob.glob('*.txt') -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatcti

Re: [Tutor] sample python twill scripts?

2008-10-02 Thread bob gailer
jeremiah wrote: Just wondering if anyone here would be interested in sharing a python twill script? I'd just like to take a gander at how others are engineering their scripts. twill? -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feeling

Re: [Tutor] bug in exam score conversion program

2008-10-04 Thread bob gailer
Lots of good responses. And now for something completely different: import string x = string.maketrans('567891', 'FDCBAA') score = raw_input('score>') print "Your grade is:", score[0].translate(x) -- Bob Gailer Chapel Hill NC 919-636-4239 When we ta

Re: [Tutor] Reading Files and Such

2008-10-04 Thread bob gailer
Jaggo wrote: So, am I to understand from this lack of response there be *no particular reason* to use Temp file? AFAIC there is no particular reason to use Temp file. It is a convenience for those of us who need temp files and don't want to bother creating unique names. -- Bob G

Re: [Tutor] Edit a Word document programmatically

2008-10-14 Thread bob gailer
sted code. doc = word.Documents.open("c:\\test.doc") # provide path to your document instead, range = doc.Content() range.Find.Text = "text to replace" range.Find.Replacement.Text = "replacement text" range.Find.Execute() doc.Save() Give that a try. Let me know what happens.

Re: [Tutor] Edit a Word document programmatically CORRECTION Open not open

2008-10-14 Thread bob gailer
bob gailer wrote: Brian C. Lane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 URBAN LANDREMAN wrote: Good morning, I'm trying to write some Python code to programmatically do a Find and Replace of a string within a Microsoft Word document. Any suggestio

Re: [Tutor] Edit a Word document programmatically CORRECTION Open not open

2008-10-14 Thread bob gailer
______ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviol

Re: [Tutor] Edit a Word document programmatically CORRECTION Open not open

2008-10-14 Thread bob gailer
Alan Gauld wrote: "bob gailer" <[EMAIL PROTECTED]> wrote docOrig = app.Documents.Open('n:\\MetroPlanners\\2006\\MCHResearchProject.doc') range = docOrig.Content() Try range = docOrig.Range() But don't use range as a variable name or you will hide th

Re: [Tutor] First time webaps as example

2008-10-15 Thread bob gailer
anguage to first get the students comfortable with the language before attempting to learn a web framework or database processing or accounting or anything else than the basic lanaguage. What do you think? -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our fe

Re: [Tutor] Difficult loop?

2008-10-16 Thread bob gailer
ecessors = predecessors[1:] + letter successors = successors[1:] + ("_" if len(successors) <= 5 else "") Simple - procedural - no functions. 16 lines of code. Easy to read and maintain. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of

Re: [Tutor] Difficult loop?

2008-10-16 Thread bob gailer
w:position+window+1] + letter elif letter == "~": print rest[position-window:position+window+1] + "~" + word.next() -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interactions with others. Nonviole

Re: [Tutor] Difficult loop?

2008-10-16 Thread bob gailer
word = iter(word) for letter in word: if letter not in shortAndOmit: position += 1 print rest[position-window:position+window+1] + "_" elif letter in shortAndOmit[:4]: print rest[position-window:position+window+1] + letter elif letter == "~": print rest[

Re: [Tutor] [Edu-sig] school physics/math courses

2008-10-18 Thread bob gailer
6 15. * if the number of dimensions is 0 (a "scalar" value) the result is the scalar value unchanged. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communicatio

Re: [Tutor] How to clear the screen

2008-10-20 Thread bob gailer
;No clear command available' I'd prefer, for compactness and readability: if not os.system('cls'): if not os.system('clear'): print 'No clear command available' -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feeling

Re: [Tutor] String and integer

2008-10-20 Thread bob gailer
3 raw_input will be renamed input and the old input will go away. Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Ch

Re: [Tutor] decision structures

2008-10-20 Thread bob gailer
se are the skills you need for this problem. Give it a stab and report back and let's see what happens. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication pro

Re: [Tutor] decision structures

2008-10-21 Thread bob gailer
print True What happens? Why? Then try if 1: print True You are trying to compare date to numbers yet date does not appear in the if statement! I have mentioned lists twice yet you have not said anything about them. Do you know what a list is and how it can be used? -- Bob Gailer Chapel H

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread bob gailer
rt the strings to integers and reverse the descending pairs. a1 = [['xa', 1511255, 1511279],['xb', 7516599, 7516623],['xc', 98356266, 98356290]] b1 = [['G1', 1511200, 1511325],['G2', 7516500, 7516625],['G3', 98356126, 98356335]] Then compare

Re: [Tutor] decision structures

2008-10-21 Thread bob gailer
r 8 or 10 or 12: return 31 elif 4 or 6 or 9 or 11: return 30 elif 2: return leap def main(): currentdate= input ("What is the date (mm/dd/)?:") month, date, year= string.split(currentdate) print month/date/year main() ___

Re: [Tutor] decision structures

2008-10-22 Thread bob gailer
I hope we did not scare you away. Do you still want help? If you get a solution elsewhere would you share it with us so we can see and celebrate your progress? -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying

Re: [Tutor] Need help w/ a for loop

2008-10-23 Thread bob gailer
nction and generator expressions: pi = sum(4.0/i for i in range(1, n*2, 4)) - sum(4.0/i for i in range(3, n*2, 4)) Applying sum and generator expressions to my original solution you get: pi = sum(4.0/i - 4.0/(i + 2) for i in range(1, 4*n, 4)) Ah I can go on can't I? A lot more than you asked fo

Re: [Tutor] csv manipulation

2008-10-29 Thread bob gailer
t;,"Tirana" "Vlorë","Delvinë","Sarandë","Vlorë" where thee first column contains the regions and the subsequent the districts. what is the best way to return a file like: "Berat","Kuçovë" "Berat","Skrapar"

Re: [Tutor] csv manipulation OOPS

2008-10-29 Thread bob gailer
quot;, "Skrapar"] region = line [0] for district in line[1:]: outputFile .write(region + "," + district + "\n") inputFile .close() outputFile .close() -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have mor

Re: [Tutor] class/type methods/functions

2008-10-30 Thread bob gailer
Format.names = config.formats.names [...more pseudo type-specific config functions...] def config() config.build_config(config_file_name) format_config() [...more calls to type config functions...] But I'm not happy with that at all... Type specific features should definitely lie insi

Re: [Tutor] fast list traversal

2008-10-30 Thread bob gailer
s? I don't know of any. Of course it could depend on what you are doing with each element. Say more! -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication pro

Re: [Tutor] Problem formatting raw_input

2008-10-31 Thread bob gailer
? In the def convert_string... function why do you include the "except ValueError: / return 0" clause? try: must be followed by except or finally. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatcti

Re: [Tutor] Debugging, other

2008-11-01 Thread bob gailer
n Beginner ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tool

Re: [Tutor] Manipulate list in place or append to a new list

2008-11-01 Thread bob gailer
ython http://numpy.scipy.org/, which works much like APL: >>> /print a/ [1 2 3] >>> /print a + 3/ [4 5 6] -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communica

Re: [Tutor] how to read over serial port

2008-11-01 Thread bob gailer
ring. so, what am i supposed to be doing to get real values out of this stream of bytes? Depends again on what you are expecting. What do you mean by "real"? -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more sat

Re: [Tutor] accessing an image with pygame.image.load()

2008-11-03 Thread bob gailer
ng with r. "C:Users\\Chris\\ etc. OR r"C:Users\Chris\ That *might* solve your problem. it is unfortunate that the error messages say can't open rather than file not found. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and nee

Re: [Tutor] Using Python to replace javascript

2008-11-06 Thread bob gailer
-- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in learning this process. What is YOUR

Re: [Tutor] Date validation?

2008-11-06 Thread bob gailer
File "", line 1, in File "H:\Python25\lib\_strptime.py", line 313, in strptime data_string[found.end():]) ValueError: unconverted data remains: 5 -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying in

Re: [Tutor] Date validation? Correction

2008-11-06 Thread bob gailer
bob gailer wrote: Eric Dorsey wrote: Greetings, I have a program where I ask a user to enter a date in format -MM-DD, and get a string like: '2008-10-25' Can anyone tell me how I would verify this is a real date before allowing it to be passed on to the next part of the progr

Re: [Tutor] Converting EBCDIC characters to ASCII

2008-11-13 Thread bob gailer
] = (v, 1) for l in range(10): for r in (11, 13): k = l*16+r v = l*10 d[chr(k)] = (v, -1) m = 10 value, sign = d[bcdstring[-1]] for byte in bcdstring[-2::-1]: value += m*d[byte] m *= 100 value = value * sign -- Bob Gailer Chapel Hill NC 919-636-4239 When we take th

Re: [Tutor] Converting EBCDIC characters to ASCII

2008-11-13 Thread bob gailer
e best approach, or is there a better way? Steve Bricker ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill N

Re: [Tutor] referencing external functions

2008-11-14 Thread bob gailer
ngful name as Word attempts to? Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in lea

Re: [Tutor] floating point accuracy [working with Fractions]

2008-11-14 Thread bob gailer
essed in a finite # of digits. You can say that math.pi is within 1/18014398509481984 of the value of pi. I don't think it matters where the decimal point lies. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satis

Re: [Tutor] pygame1.py

2008-11-14 Thread bob gailer
way to view that attachment. Please just send us a plain text file or put the code in the body of the email. -- Bob Gailer Chapel Hill NC 919-636-4239 When we become aware of our feelings and needs, and express them with care, we can more satisfying interactions with others. Nonviolent Com

Re: [Tutor] Decimal fixed point representation

2008-11-20 Thread bob gailer
Dinesh B Vadhia wrote: I'm trying to get my head around the Decimal module to understand how to represent a decimal floating point number as an integer (or integers). Huh? That makes no sense to me! Examples please. -- Bob Gailer Chapel Hill NC 919-636

Re: [Tutor] Regular expression oddity

2008-11-22 Thread bob gailer
x27; ', 't', 'e', 'x', 't', ''] Where does the last string, the empty one, come from? I find this behaviour rather annoying: I'm getting one group too many. The ? means 0 or 1 occurrence. I think re is matching the null string at the en

Re: [Tutor] Leaving PHP for Python

2008-11-25 Thread bob gailer
K Frankly, I don't understand what is going on in the above. Exactly what don't you understand. Or ... what DO you understand. There is a lot to explain here. Narrowing it down will make it easier. -- Bob Gailer Chapel Hill NC 919-636-4239 _

Re: [Tutor] Leaving PHP for Python

2008-11-25 Thread bob gailer
Please always reply all so a copy goes to the tutor list. We all participate and learn. Jason DeBord wrote: Bob, Thanks for the reply. When I said I don't understand the above, that was just to give you guys a reference for where I am at. At my current job I rarely touch the web serv

Re: [Tutor] How to get smooth, terminal-like interaction over the web

2008-11-26 Thread bob gailer
script, etc.? I'm a little bit lost, not knowing what's available out there. See http://code.google.com/p/pythoninthebrowser/. I'm looking for simplicity and ease of use for a python programmer. -- Bob Gailer Chapel Hill NC 919-636-4239 ___

Re: [Tutor] try except block for multiple statements

2008-12-01 Thread bob gailer
ouch of genius - and a lot of courage - to move in the opposite direction. " -Albert Einstein _______ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 __

Re: [Tutor] Confused about __setitem__

2008-12-04 Thread bob gailer
: Baseboard instance has no attribute '__setitem__' ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread bob gailer
Python. You could "roll your own" encoding" but I think json would be easier. Remember to reply-all so a copy goes to the list. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/m

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread bob gailer
together (C extension, SWIG, ...???) then you could write the Python object directly from the C program. What will the Python program do with the lists? And what does huge mean. Does it have to be a list? Is performance an issue or storage space or what? -- Bob Gailer Chapel Hill NC 919-636

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread bob gailer
the log file). As you might guess I was typing my response before reading the above. So you answered my question. NOW: why not read and parse the log file in Python? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org

Re: [Tutor] reading output from a c executable.

2008-12-11 Thread bob gailer
, each request to refresh the graph (changing time duration for display) will have to re-parse the file all over again. And hence speed in parsing the log is important. There should never be a need to reparse the same file. Please present the case more specifically. -- Bob Gailer Chapel Hill NC

Re: [Tutor] reading output from a c executable.

2008-12-12 Thread bob gailer
Ravi Kondamuru wrote: Denis, These are 32bit, 64bit counters (essentially numbers). Bob, There are well over 10K counters in the log file that are updated every 5 secs. If a counter1's graph was requested, log will have to be parsed once to get the data points. If a user asked for a cou

Re: [Tutor] reading output from a c executable.

2008-12-12 Thread bob gailer
Ravi Kondamuru wrote: Denis, These are 32bit, 64bit counters (essentially numbers). Bob, There are well over 10K counters in the log file that are updated every 5 secs. If a counter1's graph was requested, log will have to be parsed once to get the data points. If a user asked for a cou

Re: [Tutor] reading inputs from keyboard

2008-12-14 Thread bob gailer
thon 3 Example program: name = input("Enter your name:") print ("Hello", name) input("Press any key to exit.") The purpose of the last line - when you run the program by double-clicking or equivalent this keeps the window open so you can se

Re: [Tutor] Working with lists

2008-12-14 Thread bob gailer
in Python 3: v = [1,2,3,4] m = [] reduce(lambda x,y,m=m: (m.append(x+y), y)[1], v) print m # [3, 5, 7] -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Having Issues with CMD and the 'python' command

2008-12-15 Thread bob gailer
ight PATH under System Variables & Click Edit. Add ;C:\python26 -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] numarray issues

2008-12-15 Thread bob gailer
. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] numarray issues

2008-12-15 Thread bob gailer
Please always reply-all so a copy goes to the list. Mr Gerard Kelly wrote: is there a quick way to convert a one element array into a scalar value so that I can use x[0] for all operations?  x = x[0] - Original Message - From: bob gailer Date: Tuesday, December 16, 2008

Re: [Tutor] How to exit program without sys.exit()

2008-12-18 Thread bob gailer
ber() def sayit(): print "Your total correct answers is", counter() again() def again(): onemore = raw_input("Again? y/n >> " ) if onemore.lower() == "y": getnumber() elif onemore.lower() == "n": getinfo() e

Re: [Tutor] py_compile and chmod +x

2008-12-19 Thread bob gailer
he truth" Emad Soliman Nawfal Indiana University, Bloomington ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python parser

2008-12-22 Thread bob gailer
ogram from that. The Pipelines language is very simple, so I am not dealing with control structures, just sequences of words and symbols. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python parser

2008-12-22 Thread bob gailer
johnf wrote: On Monday 22 December 2008 09:15:13 am bob gailer wrote: johnf wrote: I've been in the programming business for over 20 years and I have never had a need for a parser. But recently I have need to convert code from one language to a my new language python.

Re: [Tutor] python parser

2008-12-22 Thread bob gailer
temporarily by commands like text ; is a special final character assignment statement? initial word a keyword or function? if none of the above error? and on and on. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@pyt

Re: [Tutor] python parser

2008-12-23 Thread bob gailer
ndent when encountering the start or end of a structure. a bigger challenge is handling the work-area related commands such as Scan, Replace, Skip, Set Relation, Actually Bob I'm using Dabo which has the above covered. You should take a close look at Dabo. I am able to do most

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread bob gailer
how long the cycle is. Kent Check out http://en.wikipedia.org/wiki/Repeating_decimal. Section 5 How a repeating or terminating decimal expansion is found illustrates the above. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist -

Re: [Tutor] strip function

2008-12-24 Thread bob gailer
place('/companies', '') or item_path[len('/companies'):] or item_path.split('/')[2:] -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] beginsWith multiple prefixes

2008-12-24 Thread bob gailer
" Emad Soliman Nawfal Indiana University, Bloomington http://emnawfal.googlepages.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] Printing the code of a function

2008-12-28 Thread bob gailer
AIM - samushack | Gtalk - samushack | Skype - shuckins ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor mailli

Re: [Tutor] Exception Handling

2008-12-28 Thread bob gailer
; dnum: print "You are %i" % ynum, "years old." break else: ret = int(ynum) - 1 print "You are %i" % ret, "years old." break except ValueError: print "Oops, You mus

Re: [Tutor] optional parameter in list comprehension

2008-12-29 Thread bob gailer
Dj Gilcrease wrote: def myfiles(directory,extension=None): for x in [os.path.join(x,i) for x,y,z in os.walk(directory)\ if extension: << SYNTAX ERROR! for i in z if i.endswith(extension)]:print x -- Bob Gailer Chapel Hill NC 919-63

Re: [Tutor] optional parameter in list comprehension

2008-12-29 Thread bob gailer
n26','doc') C:\python26\Doc\examples.doc How can I rectify this? Thanks Prasad _______ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chape

Re: [Tutor] format currency

2009-01-02 Thread bob gailer
the relevant data is in one place. Then you need no if statement. I also assume that only one dictionary will be selected. Then you don't need the for loop. x = [d for d in currencies if d['is_selected'] == True][0] This could be a great application for the recently discussed na

Re: [Tutor] tuple & object's attributes (changed)

2009-01-02 Thread bob gailer
only an homogeneous (numeric only, all elements the same type) collection. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Better way - fnmatch with list ?

2009-01-02 Thread bob gailer
he conversations on this list is a little like taking a python class (only the classes don't progress in any particular order!). _______ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Better way - fnmatch with list ? CORRECTION

2009-01-02 Thread bob gailer
bob gailer wrote: Damon Timm wrote: Hi - am learning Pythong and loving it! Anyhow, what I have works, but I wondered if there was a "better" (more python-y) way. Here is what I am doing with fnmatch ... am thinking there has to be a one-line way to do this with a lamb

Re: [Tutor] create an empty array of images

2009-01-03 Thread bob gailer
understand your question. In addition to pseudocode would you give a description of what the user sees and does and how the end result looks to the user. From your code I think I would see a pink flower flashed numOne times. Also please clean up the code. The indentations are messy. -- Bob Gailer

Re: [Tutor] Help with a simple problem

2009-01-03 Thread bob gailer
27;))                     app = QtGui.QApplication(sys.argv) testgui = TestGui() testgui.show() sys.exit(app.exec_()) _______ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] Help with a simple problem

2009-01-03 Thread bob gailer
ot;os.system('wvdial')" (character string). So try self.connect(dial, QtCore.SIGNAL('clicked()'), QtGui.qApp, QtCore.SLOT("os.system('wvdial')")). -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] create an empty array of images

2009-01-03 Thread bob gailer
ariable for the inner for. Pick some other name. a = [i] self.image = gtk.Image() self.image.set_from_file("./Pink-Flower-32x32.png") self.fixed.put(self.image, i*25, 0) self.image.show() -- Bob Gailer Cha

Re: [Tutor] Add all natural numbers that are multiples of 3 and 5

2009-01-03 Thread bob gailer
then multiply by 3 Calculate that for 1..199 then multiply by 5 add those Calculate that for 1..66 then multiply by 15 subtract that from the total I think that will give you the answer with minimal computation time. -- Bob Gailer Chapel Hill NC 919-636

Re: [Tutor] Add all natural numbers that are multiples of 3 and 5

2009-01-04 Thread bob gailer
Alan Gauld wrote: "bob gailer" wrote Also consider that the sum of consecutive integers between 1 and n is n*(n+1)/2. Calculate that for 1..333 then multiply by 3 Calculate that for 1..199 then multiply by 5 add those Calculate that for 1..66 then multiply by 15 subtract that from

Re: [Tutor] RE Silliness

2009-01-04 Thread bob gailer
receding RE. ab? will match either 'a' or 'ab'. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

<    5   6   7   8   9   10   11   12   13   14   >