[Tutor] PYTHONPATH-corrected

2009-06-30 Thread Bob Rea
is on a suse linux 10 box -- Bob Rea mailto:pet...@petard.us http://www.petard.us http://www.petard.us/blog http://www.petard.us/gallery ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Needing Help

2009-06-30 Thread Bob Rea
way through _Making Use of Python_ by Rashi Gupta. I am using Python 2.4.1 I have run into problems in a script, listed at http://python.pastebin.com/m51bc3388 If I input my own name and dob, it works: b...@gandalf:~/python/MakingUse/Chapter05> python code1.py Enter your first name: Bob Enter yo

Re: [Tutor] Needing Help

2009-06-30 Thread Bob Rea
On Tue June 30 2009 3:20 pm, you wrote: > On Tue, Jun 30, 2009 at 1:06 PM, Bob Rea wrote: > > > > If I input my own name and dob, it works: > > b...@gandalf:~/python/MakingUse/Chapter05> python > > code1.py Enter your first name: Bob > > Enter your last nam

Re: [Tutor] Python Programming exercise

2009-07-01 Thread bob gailer
print "Password Confirmed" 2 ways - either 1. while count != 3 and guess != password: or 11. print "Password Confirmed" 12. break -- Bob Gailer Chapel Hill NC 919-636-4239 ___

Re: [Tutor] list comprehension problem

2009-07-03 Thread bob gailer
both reduce and scan, where scan gives you exactly what you want. WIBNI Python had scan? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Stack unwind using exceptions.

2009-07-05 Thread bob gailer
call chain. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Poor style to use list as "array"?

2009-07-05 Thread bob gailer
e0> (retention: 1 day) Could I have used dictionaries instead, with the denomination names as keys? Is it possible to guarantee a sequence in which the keys of a dictionary are iterated through? (If not, I suppose I could keep the list 'denom' as it is here, and iterate through it with "for key in denom:", although this seems a bit redundant.) -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Poor style to use list as "array"? CORRECTION

2009-07-06 Thread bob gailer
27;pennies') amnt = 99 buff = [] for coin in coins: (coin.count, amnt) = divmod(amnt, coin.value) d = coin.display() if d: buff.append(d) if len(buff) < 2: print buff else: print ', '.join(buff[:-1]) + " and " + buff[-1] -- Bob Gailer Chapel Hill NC 919-636-4239 __

Re: [Tutor] using datetime and calculating hourly average

2009-07-07 Thread bob gailer
ne?, don't. Please show us more of the program, including the import statement(s), and some sample input data. What leads you to think is is slow? One opportunity for improvement - take the invariant out of the while statement. q = dt.datetime(*X[-1,0].timetuple()[0:4]) wh

Re: [Tutor] error message

2009-07-08 Thread bob gailer
51, 2: 42} In [5]: _______ 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] University student struggling!

2009-07-14 Thread bob gailer
ion includes Python, web servers, HTML. Have you asked the question in other fora? Is there a link to this and prior problems that we can visit? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

Re: [Tutor] assigning list to keys

2009-07-14 Thread bob gailer
mean dict['int'] = list[-1]? You should also avoid shadowing built-in names like "list", "dict", "file" etc as you can very easily end up with unexplained errors. Hope that helps. -- Bob Gailer Chapel Hill NC 919-636-4239 _

Re: [Tutor] objects becoming pointers

2009-07-15 Thread bob gailer
ting variable names. Preferred is a dictionary. names = {} # empty dictionary name=raw_input() names[name]=zeroes((3,3)) print names["Chris"] -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] objects becoming pointers

2009-07-15 Thread bob gailer
evolve beyond simple command line interfaces. At that point dealing with dynamically created names becomes a pain. With a little finessing you can create a class instance with attributes that are names such as Chris. Then you could >>> print c.Chris -- Bob Gaile

Re: [Tutor] reading complex data types from text file

2009-07-16 Thread bob gailer
t process all the scores before computing averages. This means saving each player's score. Use a dictionary with the name as the key and the score as the value. Then go thru the dictionary to compute and report averages. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] reading complex data types from text file

2009-07-17 Thread bob gailer
* 50) + "\n") for name, score in scores.items(): if score == 300: score = "\tPerfect score!" elif score < averageScore: score = "\tBelow average" elif score > averageScore: score = "\tAbove averag

Re: [Tutor] Help with % conversion to output colour

2009-07-18 Thread bob gailer
fraction)*red1 + fraction*red2 g = (1-fraction)*green1 + fraction*green2 b = (1-fraction)*blue1 + fraction*blue2 print ' " The output of that is (e.g.) print "" -------- ___ 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 interpreter vs bat file

2009-07-19 Thread bob gailer
Python programs (as it should). What happens if you open a CMD window, run program 1, close CMD window, and repeat for the other programs? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] advice on creating and working with a complex data structure

2009-07-20 Thread bob gailer
committees - campaign committees can file multiple reports I'm trying to pull these records from a database and output them to an HTML file in sorted order. I suggest using the ORDER BY SQL Clause rather than trying to sort it in Python. [snip] -- Bob Gailer Chapel Hill

Re: [Tutor] Reading Data From File

2009-07-25 Thread bob gailer
u know how to print a line? what is the criteria for determining A, B C, D, or F average? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Eng to Leet Speek

2009-07-27 Thread bob gailer
substitutions. Which could be applied to all the 1 character substitutions after dealing with the multi-character ones. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to get blank value

2009-07-28 Thread bob gailer
ll i am not getting. Amrita Kumari Research Fellow IISER Mohali Chandigarh INDIA -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to get blank value

2009-07-28 Thread bob gailer
: # N and CA values missing print "all missing", line else: print "C missing", line -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] easy way to populate a dict with functions

2009-08-06 Thread bob gailer
gal parameter (%s)" % parameter check_command() # end code --- cmds is a list similar to: [('bletch', ), ('foo', ), ('romans', ), ('stilton', )] -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] easy way to populate a dict with functions

2009-08-06 Thread bob gailer
Albert-Jan Roskam wrote: Hi Bob, Very neat solution, thanks a lot! I didn't know the inspect module, but it's just what's needed here. Cool! Great. Regarding the ordering of functions in the list - variable names in namespaces (such as modules) are stored in dictionaries.

Re: [Tutor] this module

2009-08-09 Thread bob gailer
write many many modules. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] droplet like behaviour in Python

2009-08-10 Thread bob gailer
nced Choose open Click Edit in my system I see "H:\Python30\python.exe" "%1" %* which means fire up python.exe, pass the dropped file name as the first argument. BTW a nice 1 python line version independent droplet: #!/usr/bin/env python # encoding: utf-8 input(__import__('

Re: [Tutor] easy way to populate a dict with functions

2009-08-11 Thread bob gailer
Albert-Jan Roskam wrote: Hi Bob, Sorry for the late reply, but thank you for your code. I still haven't completely wrappped my brain around decorator functions, but thanks to your reply at least now my frontal lobe is touching it. ;-) Decorator functions: def collect(func

Re: [Tutor] easy way to populate a dict with functions

2009-08-11 Thread bob gailer
Kent Johnson wrote: On Tue, Aug 11, 2009 at 10:22 AM, bob gailer wrote: Decorator functions: def collect(func): 'a "decorator" that adds each function to the cmds list' cmds.append((func.__name__, func)) Decorators must return a callable The docs inde

Re: [Tutor] string.title(): correct?

2009-08-11 Thread bob gailer
rt with uppercase characters, all remaining cased characters are lowercase." It depends on the definition of "word". -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Dynamic Function Calls

2009-08-14 Thread bob gailer
ny definition for func0 in the above snippet. Where is it defined? Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tut

Re: [Tutor] rationale for nested classes?

2009-08-14 Thread bob gailer
r grouping conceptually related classes that don't share attributes?). Or is it typically better to keep all classes on the same level of a heirarchy, and then just use inheritance to establish parent-child relationships where appropriate? -- Bob Gailer Chapel Hill

Re: [Tutor] Iterating through objects

2009-08-16 Thread bob gailer
GoodPotatoes wrote: I'm not sure if I've been searching using the correct terms. After I've iterated through an object, such as a cursor or webpage, how do I get back to the "top"? e.g. tutorial from http://www.daniweb.com/code/snippet563.html# print page1.readlines() Capture the lines in

Re: [Tutor] Tracking variable changes in a different application

2009-09-02 Thread bob gailer
t connection that listens, and have your application periodically connect to the socket, at which point the "application which data I'm accessing" will return the changes. 3) using pywin32 make it a COM server. Your application will establish a COM connection to it and reque

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread bob gailer
Python. I just went through some Ruby tutorials. I see some neat things, but in general it seems that Ruby requires more keyboard activity (typing) to get the same result. I will stick with Python. But then there are those who stick with COBOL, so who knows the truth? -- Bob Gailer Chapel

Re: [Tutor] (no subject)

2009-09-04 Thread bob gailer
In Python they are for or while, not if. Also realize the above, when converted to a while loop will never terminate, since i keeps growing. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change su

[Tutor] working with multiple sets

2009-09-05 Thread bob gailer
I kinda get it, the thing that warps my brain is the idea that there are more than 2 lists now to test against eventually my script needs to accommodate 4, 5, 6 sets.. but i would just like to see if i can get 3 sets to work first. -- Bob Gailer Chapel Hill NC 919-636-4239 ___

Re: [Tutor] Pyduino

2009-09-07 Thread bob gailer
Joshua Harper wrote: I just bought an arduino and id like to use python instead of the arduino language, any tips, tutorials, anything, i googled but there isnt much on it really.. about 3,000,000 results? -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] working with multiple sets

2009-09-08 Thread bob gailer
as it used in this instance? It simplifies coding, as it takes care of initializing each new entry to a list. On Sep 6, 2009, at 3:06 AM, bob gailer wrote: I want to be able to look at a number/item and see which lists it is in so that i could maybe have a master list of all the data, a sup

Re: [Tutor] (no subject)

2009-09-13 Thread bob gailer
, tuple2 You probably want something different. So explain please. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Displaying elements of twoTuples

2009-09-14 Thread bob gailer
ssible deck of cards or suits.Ac Ah As Ad 2d 3d 4d 5d 6d 7d 8d 9d 10d Jd Qd Kd also note that you can use strings instead of tuples: (using T instead of 10) values = "A23456789TJQK" suits = "chsd" OR values = "A 2 3 4 5 6 7 8 9 10 J Q K".split() -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] New guy question...

2009-09-14 Thread bob gailer
Sorry - I can't explain that. But consider a simplified program: total = 0 count = 0 line = input() while line: if line.isdigit(): number = int(line) total += number count += 1 else: print( "BLARGH : ", err ) line = input() if count: print(

Re: [Tutor] collecting certain data from a textfile

2009-09-15 Thread bob gailer
) wanted = (data2) If you are concerned about enough memory, write data2 to the file instead of collecting in a list. f3.append(wanted + "\n") Drop next line: i += 3 f4 = open('wanted.txt', 'w') f4.write(''.join(f3)) f2.clos

Re: [Tutor] collecting certain data from a textfile

2009-09-16 Thread bob gailer
tuple of lines: (untested) a=f2.readline() if not a: break b=f2.readline() c=f2.readline() lines = (a,b,c) iterate over the lines and their respective slices: data2 = [] for x in range(len(lines)): for s in slices[x]: data2.append(lines[x][s].strip() OV 2009/9/15 bob gai

Re: [Tutor] html color coding: where to start

2009-09-17 Thread bob gailer
------ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Calling VB.NET code with Python .. VB.net - Python integration ..

2009-09-18 Thread bob gailer
win32/Build%20214/pywin32-214.win32-py2.6.exe/download import wincom32.client com = wincom32.client.Dispatch( application name or classid of the vb.net app) # now you have a com object with which you can send commands to the vb.net app and receive data back. -- Bob Gailer Chapel Hill NC 919-636

Re: [Tutor] UnboundLocalError and Break

2009-09-30 Thread bob gailer
, line 157, in monsAttk playHp -= damage UnboundLocalError: local variable 'playHp' referenced before assignment If you could please help me, that would be great. I'm just trying to get the game engine working, as of now, it is 30% done, with Inventory, Equipment,

Re: [Tutor] small program

2009-10-02 Thread bob gailer
u try to run it? That is step one. Try to run it. See if you can figure out why it fails. Hint there are 2 syntax errors. At python.org there are links to several tutorials which will show you how to repeat operations. To repeat things in Python we can use a loop. What Python statements are

Re: [Tutor] Using command line tool with python script

2009-10-05 Thread bob gailer
e temp.txt") I wonder if that possible to execute this script (called application) without writing the file with initial data to the hard disk? Take a look at os.system() -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread bob gailer
g problem if the goal is to get to the truth."  -Dr. Steven Hyman, Harvard ___ Tutor maillist  -  Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Python 3 and tkinter Radiobuttons

2009-10-08 Thread bob smith
sticky = W) root.mainloop() Does anyone know how to solve this issue? Anyone know if this is a bug being worked on? Thanks, --Bob _ Hotmail: Powerful Free email with security by Micro

Re: [Tutor] Python 3 and tkinter Radiobuttons

2009-10-10 Thread bob smith
button(root, text = "Test RadioButton 2", variable=v, value="2").grid(row = 1, column = 0, sticky = W) root.mainloop() Any ideas on how to have a StringVar() associated with a group of Radiobutton objects where all of the radio buttons start off unselected? --Bob > Da

Re: [Tutor] Python 3 and tkinter Radiobuttons

2009-10-11 Thread bob smith
is a bug in tkinter for Python 3? (I know when using an IntVar, you don't need to do this). Is this the best solution for now? Thanks, --Bob _

Re: [Tutor] Carriage return

2009-10-11 Thread bob gailer
to remove ^M from the end of every line. Though it is not shown while programming but I can see that when I run my scripts on debian linux environment & thus get errors. I don't understand. Please explain. -- Bob Gailer Chapel Hill NC 919-636-4239 ___

Re: [Tutor] Putting a variable into a statement

2009-10-15 Thread bob gailer
hrough all of the values of the properties tuple and get each value? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] Putting a variable into a statement

2009-10-15 Thread bob gailer
tr__ raise AttributeError AttributeError My previous suggestion was assuming that elements of myuser.properties were strings (names of the properties). If instead they are the properties then you'd print x -- Bob Gailer Chapel Hill NC 919-636-4239 _

Re: [Tutor] Pack as HEX question

2009-10-24 Thread bob gailer
(packed_XorKey))] -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Being beaten up by a tuple that's an integer thats a tuple that may be an unknown 'thing'.

2009-11-03 Thread bob gailer
immutable. Replace them with lists and voila. l1=[[0,0]] * 4 But also realize that you are creating a list with 4 copies of one object [0,0]. Assigning to one changes all! -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@pyt

Re: [Tutor] Printing Sideway...

2009-11-07 Thread bob gailer
the envelope now? Instead of printing from left to right on the long side of a #10 envelope, I wish to print sideway, printing from the left short edge of envelope to its right short edge. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist

Re: [Tutor] Printing Sideway...

2009-11-07 Thread bob gailer
. How do you communicate from Python to these programs? Instead of printing from left to right on the long side of a #10 envelope, I wish to print sideway, printing from the left short edge of envelope to its right short edge. -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] pattern searching

2009-11-08 Thread bob gailer
Lie Ryan wrote: Ajith Gopinath wrote: Thanks folks. || a j i t || On Sat, Nov 7, 2009 at 7:49 AM, bob gailer <mailto:bgai...@gmail.com>> wrote: Shashwat Anand wrote: @Bob: the solution seems promising, and it's fast. Thanks for the improvement. However I

Re: [Tutor] importing variables

2009-11-12 Thread bob gailer
sed your point, I understood it. So your explanation was OK (for me). print getattr(features, a) -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help on finding the 1000th prime

2009-11-16 Thread bob gailer
many algorithms for this - you might consult Wikipedia for ideas. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread bob gailer
range(2, primeCandidate): if primeCandidate % x == 0: print primeCandidate, "equals", x, "*", primeCandidate/x isPrime = False Print primeCandidate break If isPrime: primeCount = primeCount + 2 Print primeCandidate

Re: [Tutor] Introduction - log exercise

2009-11-17 Thread bob gailer
ank? Better logic: # open files paragraph = [] keep = True for line in fileIn: if line.isspace(): # end of paragraph if keep: outFile.writelines(paragraph) paragraph = [] keep = True else: if keep: if line == '\tfoo': keep = False else: paragraph.appe

Re: [Tutor] Introduction - log exercise

2009-11-17 Thread bob gailer
re. No? or is there anything that I don't get? I think the test should be: if not line.isspace and 'foo' not in line: fileOut.write(line) No - that misses the objective of eliminating blocks containing 'foo' -- Bob Gailer Chapel Hill NC 919-636-4239 __

Re: [Tutor] Introduction - log exercise

2009-11-17 Thread bob gailer
Antonio de la Fuente wrote: * bob gailer [2009-11-17 15:26:20 -0500]: Date: Tue, 17 Nov 2009 15:26:20 -0500 From: bob gailer To: Antonio de la Fuente CC: Python Tutor mailing list Subject: Re: [Tutor] Introduction - log exercise User-Agent: Thunderbird 2.0.0.23 (Windows/20090812

Re: [Tutor] Readable date arithmetic

2009-11-20 Thread bob gailer
e a specification of the algorithm. What is is to do. Saves me a lot of time trying to decipher the code. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.

Re: [Tutor] Global Variables

2009-11-21 Thread bob gailer
not defined What it does is alert the compiler that assignment to the variable will make it global. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread bob gailer
e target (which, unlike normal assignment statements, cannot be an unpacking) and the expression list, performs the binary operation specific to the type of assignment on the two operands, and assigns the result to the original target." -- Bob Gailer Chapel

Re: [Tutor] AttributeError: Vector instance has no attribute 'Normalize'

2009-11-27 Thread bob gailer
th() def __sub__(self, right): return Vector(self.x - right.x, self.y - right.y, self.z - right.z) -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] numerical simulation + SQLite

2009-11-30 Thread bob gailer
after the simulation run? How precise do the numbers have to be? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python at my work

2009-12-03 Thread bob gailer
tements. I don't see in Perl generators, comprehensions, generator expressions, with statement, threading. Exception handling seems limited. I think the syntax is ugly. - Fits in your head - what does that mean? - Batteries included - what does that mean? - Large library(Cheese Shop) - does Perl also

Re: [Tutor] win32com and ocx with properties

2009-12-09 Thread bob gailer
ue? I'm sure others need to set properties in com objects. BTW does anyone know of a win32com forum or list? There is python-wi...@python.org -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python and database firebird

2009-12-15 Thread bob gailer
se page 12839') -- Криле имат само тия, дето дето сърцето им иска да лети ! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer Chapel Hill NC 919-636-4239 __

Re: [Tutor] Entry-level open source opportunities

2009-12-15 Thread bob gailer
/search/ I do not understand what I see on this site or how to use it. Are there any instructions? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org

Re: [Tutor] subclass question

2009-12-21 Thread bob gailer
erm is for sub-variables? Is there a way to make your own classes restricted like that? Classes, instances, functions may have user-defined attributes. Built-in data types such as list may not. Hence the need to subclass (e.g. list) to add additional attributes. -- Bob Gailer Chapel Hill

Re: [Tutor] How can I make this run faster?

2009-12-21 Thread bob gailer
lWords) wordDict = collections.defaultdict(list) for word in uniqueOriginalWords: wordDict[devowel(word)].append(word) for lex, wordList in wordDict.iteritems(): print lex, " ".join(wordList) main() -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Error writing to file...

2009-12-25 Thread bob gailer
The docs say "write( str) - Write a string to the file." Only a string. Regardless of mode. Mode mostly affects interpretation of line ends. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] How to open the closed file again?

2010-01-05 Thread bob gailer
It might help us help you if you tell us a bit more about what you want to accomplish. -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman

Re: [Tutor] need help with 3.1's fraction module

2010-01-06 Thread bob gailer
external interpreter File "C:\Python31\Lib\fractions.py", line 100, in __new__ raise TypeError("argument should be a string " builtins.TypeError: argument should be a string or a Rational instance But what does work? Fraction(str(random())).limit_denominator

Re: [Tutor] (no subject)

2010-01-07 Thread bob gailer
very slow. Suggestions: Translate the values to integer outside the comparison loop. Test for >= lower value and <= upper value. xrange is overkill. Be aware of Python's shortcut: lower <= x <= upper. Use: for m in f1: ... for j in f2:

Re: [Tutor] Matrix

2004-12-20 Thread Bob Gailer
ous to a relatively new Pythoneer. Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] happy holidays!

2004-12-24 Thread Bob Gailer
ed ones to debrief the holidays in this light and to create next year's in a way that is more satisfying, Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] O.T.

2004-12-27 Thread Bob Gibson
Jacob: Age: 50 (ooh, I don't feel "that" old :-) Status: Married for 25 years (last Sept). Kids: 5 (all adopted) - ages: 20, 18, 6.5, 6.5, 6.5 Languages: "American" English only Programming Languages: (note, some are "forgotten" - i.e., haven't used in > 10 years) --

Re: [Tutor] O.T.

2004-12-28 Thread Bob Gailer
cess! I highly recommend it. www.cnvc.org. Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Sorting/filtering data, dictionary question

2005-01-03 Thread Bob Gibson
Bill: Could you have the "LineEdit#" be your sortable field? If each # after the "LineEdit" prefix were the same length, then you could easily sort on it. Bob ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Sorting/filtering data, dictionary question

2005-01-04 Thread Bob Gibson
Bill: Sometimes seeing something simple like this can make all the difference. Glad to be able to help. Bob ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List comprehensions

2005-01-12 Thread Bob Gailer
At 04:48 PM 1/12/2005, Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy seeing an example. Bob Gailer mailto:[

Re: [Tutor] List comprehensions

2005-01-12 Thread Bob Gailer
At 07:05 PM 1/12/2005, Kent Johnson wrote: I suppose if it's an expression, it must be valid, eh? Otherwise it's something else. At 06:41 PM 1/12/2005, Max Noel wrote: On Jan 13, 2005, at 01:13, Bob Gailer wrote: At 04:48 PM 1/12/2005, Kent Johnson wrote: If you mean for j to be a list

Re: [Tutor] List comprehensions

2005-01-13 Thread Bob Gailer
inds me of a proposal a long time ago for a COME FROM statement in FORTRAN. Bob Gailer mailto:[EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Bob Gailer
ice that he's never gonna go jogging if the weather is bad? Unless I've got input() wrong, it only takes integers... ? From the docs: input( [prompt]) Equivalent to eval(raw_input(prompt)). Bob Gailer mailto:[EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell __

RE: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-07 Thread Bob Gailer
'd' : lambda: pass } ftable.get(var, lambda: print 'default case')() From the docs: lambda arguments: expression print 'a' is not an expression File "C:\scratch\Script1.py", line 2 ftable = { 'a' : lambda: print 'a',

RE: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-07 Thread Bob Gailer
st the expressions: ftable = { 'a' : 'a', 'b' : 'b or c', 'c' : 'b or c', 'd' : ''} print ftable.get(var, 'default case') Bob Gailer mailto:[EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Printing columns of data

2005-02-08 Thread Bob Gailer
in cols:     ts = line[0] #    print line[0]     pe = line[1] #    print line[1] print """ Timestep    PE""" print "%s  %s " % (ts,pe) outp.close() Put the print statement in the for loop. for line in cols:     ...     prin

Re: [Tutor] help

2005-02-09 Thread Bob Gailer
kill everyone in this room for a drop of sweet beer." Homer Simpson __ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python

e-mail address change (was Re: [Tutor] python's default argument value handling in functions - weird syntax? problem grappling with the concept)

2005-02-09 Thread Bob Gailer
ies the list each time you invoke it. But when the default value for 'L' is none, the 'if' never catches? How is this possible? Or even consider the example given - def f(a, L=None): if L is None: L = [] L.append(a) return L How is 'L == None' even possible

Re: e-mail address change (was Re: [Tutor] python's default argument value handling in functions - weird syntax? problem grappling with the concept)

2005-02-09 Thread Bob Gailer
arted acting funny. I had to reboot it.. First I knew of the problem was when I saw the posting you are referring to. Perhaps my box has a virus. Bob Gailer mailto:[EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org

Re: ****SPAM(10.2)**** [Tutor] Re: python's default argument value handling in functions - weird syntax? problem grappling with the concept

2005-02-10 Thread Bob Gailer
x27;s blind spots. Bob Gailer mailto:[EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Negative IF conditions

2005-02-11 Thread Bob Gailer
At 08:52 AM 2/11/2005, Mark Brown wrote: Hi, I'm a newbie and was wondering which of these IF conditions is better structure: if not os.path.exists('filename'): IMHO the above is preferable to the below. It is much more "intuitive". if os.path.exists('filename&#

<    1   2   3   4   5   6   7   8   9   10   >