Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-11 Thread Bob Gailer
://mail.python.org/mailman/listinfo/tutor 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
if one preferred over the other? Note that in Python in general, 'not x' and 'x == False' are not equivalent; 'not x' will be true for many more values than just False. For example not 0 not 0.0 not [] not {} are all True. Oops. 0 and 0.0 do == False. Bob Gailer mailt

Re: [Tutor] Negative IF conditions

2005-02-11 Thread Bob Gailer
0.0 not [] not {} are all True. Kent Thanks Mark Brown ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

Re: ****SPAM(7.4)**** Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-13 Thread Bob Gailer
.): statements to process object of type 1 class A2(A); def foo(self, ...): statements to process object of type 2 That takes less code. Eliminates the type property. I get greater visibility about the existence and distinction of the two (or more) sub-types. I now can much more eas

Re: [Tutor] Case acceptance using raw_input

2005-02-16 Thread Bob Gailer
'y' or action == 'Y': if action == 'Y': anotherFunction() etc. 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: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-17 Thread Bob Gailer
At 03:04 PM 2/16/2005, Brian van den Broek wrote: Terry Carroll said unto the world upon 2005-02-16 16:18: On Fri, 11 Feb 2005, Bob Gailer wrote: Whenever you find yourself writing an if statement ask whether this would be better handled by subclasses. Whenever you find yourself about to write a

[Tutor] Re: database programming

2005-02-21 Thread Bob Gibson
> hi there! can u pls send me sample code in accessing a simple database > using python. > > Chris Mallari > thanks Chris: How about "Jython"? Here's an article that I just wrote: http://www-128.ibm.com/developerworks/db2/library/techarticle

[Tutor] Re: database programming (list of tables)

2005-02-21 Thread Bob Gibson
Liam: I agree with Kent. It depends. Not only on the database, but also on the interface (API) used to connect to the database. For example, if you use ODBC to connect to all of your databases, you should be able to use the SQLTables() routine. For more details, see the following: ht

Re: ****SPAM(11.8)**** Re: [Tutor] returning table elements with Beautiful Soup

2005-03-07 Thread Bob Gailer
p. Thanks for pointing it out. Alan G. ___ Tutor maillist  -  Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 303 442 2625 cell ___ Tu

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Bob Gailer
# displays [snip] Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Re: Help with classes

2005-04-07 Thread Bob Gailer
ayer is in plus the connected rooms), an Item class (with subclasses for different types of items, where different implementations of e.g. PickUp methods would determine if the player could pick up a pencil or a skyscraper), etc. Yours, Andrei _______ Tutor maill

Re: [Tutor] using a dictionary??

2005-04-20 Thread Bob Gailer
ess Releases'"} print html_quote(responses.get(db, "Unknown News Database! " + db)) BTW there is no benefit to print '%s' % blahblah. print blahblah does the same thing. [snip] I know there's a proper way to do this with a tuple, or something :) For the three

[Tutor] Re: [Pythonmac-SIG] Re: Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-22 Thread Bob Ippolito
Wing and IDLE don't have this problem, last I checked. Other than that, I have no idea which IDEs are stupid and which are not. -bob ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] scoping oddity

2005-05-07 Thread Bob Gailer
n a reference and it all barfs. This is what the global statement is for: def testb(astr):     global x     x = x - 1     etc. Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] scoping oddity

2005-05-07 Thread Bob Gailer
uot;. For quick and dirty programming global can save the day. For anything intended to be larger, more permanent I usually advocate use of classes. [snip] Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist

Re: [Tutor] [ANN] new version of rur-ple (0.8.5)

2005-05-10 Thread Bob Gailer
that's incorrect. Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [ANN] new version of rur-ple (0.8.5)

2005-05-10 Thread Bob Gailer
At 10:34 AM 5/10/2005, Bob Gailer wrote: At 08:48 PM 5/9/2005, André Roberge wrote: Version 0.8.5 of rur-ple has been released. The web site has completely changed; it includes over 35 pages. http://rur-ple.sourceforge.net/ -- Learning to program computer

Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Bob Gailer
you apply the preceding solutions to the URL? Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [ANN] new version of rur-ple (0.8.5)

2005-05-10 Thread Bob Gailer
At 12:41 PM 5/10/2005, Andre Roberge wrote: On 5/10/05, Bob Gailer <[EMAIL PROTECTED]> wrote: >  At 08:48 PM 5/9/2005, André Roberge wrote: [snip] >  On http://rur-ple.sourceforge.net/en/errors.htm Reeborg > appears as Egrebor. I assume that's incorrect. >  > You a

Re: [Tutor] character format

2005-05-11 Thread Bob Gailer
the BZ characters would be a big co-incidence). =Tony.Meyer ___ Tutor maillist  -  Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor

Re: [Tutor] Compare hours

2005-05-12 Thread Bob Gailer
:30" all of the above are strings I have to get the system date and time and check if they are between the strings and check that days are the same Can anyone send me an explained code cause I don't know how to work with dates and times in Python (Never needed it until now) Take a look at

Re: [Tutor] Why use apply()?

2005-05-12 Thread Bob Gailer
is completely equivalent." Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] all methods in a module

2005-05-27 Thread Bob Gailer
uff in random's dict: methods = [name, str(object.__doc__)   for name, object in random.__dict__.iteritems()   if callable(object) and object.__doc__] Then you can iterate over methods and format/print as desired. Bob Gailer mailto:[EMAIL

Re: [Tutor] Formatted writing to a file

2005-05-27 Thread Bob Gailer
formatting string '%25s' intiger (in this case 25) a variable? Use %*s. Assuming width = 25: %25s' % 3 == '%*s' % (width, 3) Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.o

Re: [Tutor] increment operator

2005-05-27 Thread Bob Gailer
At 08:25 PM 5/27/2005, Servando Garcia wrote: Is there an increment operator in python similar to c++ like SomeVariable++ No. Closest is SomeVariable += 1. Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist

Re: [Tutor] Formatted writing to a file

2005-05-27 Thread Bob Gailer
tutor http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist  -  Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___

Re: [Tutor] Building an SQL query

2005-06-02 Thread Bob Gailer
   WHERE id IN ''' + str(ids_to_process) This would, of course, set the 'state' column to 'processed' for all of the ids in the list, but can not figure out how to get this into a query to pass to the database.  Have any of you smart cookies out there dealt with this

Re: [Tutor] How interacts Python with .exe files

2005-06-02 Thread Bob Gailer
At 07:56 AM 6/2/2005, Xabier Gonzalez wrote: I wanted to know how can I use in Python the inputs and the outputs of an .exe file. Take a look at the popen2 module. Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor

[Tutor] Connect to Apache Derby databases using Python

2005-06-02 Thread Bob Gibson
For Your Information / Enjoyment / Entertainment / Education... (whatever): http://www.ibm.com/developerworks/db2/library/techarticle/dm-0505gibson Bob ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] html scrapeing

2005-06-30 Thread Bob Gailer
to locate lines starting with to find each new row, then to find each cell, then search past the tag(s) to find the cell text. You have 3 cases to deal with: Glastonbury 2005 BBC THREE Is that enough to get you started? Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 72

Re: [Tutor] Problem with data storage

2005-07-06 Thread Bob Gailer
At 08:36 AM 7/6/2005, festus freeborn wrote: plz I need infor About "Problem with data storage" We need more information. How does this question relate to Python? What is the problem you are having? Why do you need to know? Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938

Re: [Tutor] file io: reading an int32 at the end of a file?

2005-07-06 Thread Bob Gailer
__ Tutor maillist  -  Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] ot, " pythonmonks

2005-07-18 Thread Bob Gailer
At 03:52 AM 7/14/2005, Johan Meskens CS3 jmcs3 wrote: hello is there such a place as www.perlmonks.org for python ? My first and only visit to perlmonks leaves me puzzled. What is it for? All I see are posts and chats, nothing to help a newcomer grok the site. Bob Gailer phone 510 978 4454

Re: [Tutor] When I run this code, it just keeps repeating.

2005-08-01 Thread Bob Gailer
l_opt <= len(menuItems):     menuItem = menuItems[cal_opt - 1]     if menuItem[0] = "Exit":return False     prompt1, prompt2, oper, func =  menuItem[1:]     X = input(prompt1)     Y = input(prompt2)     print X, oper, Y, "= ", func(X, Y)   else:     print "That's no

Re: [Tutor] question on string

2005-08-01 Thread Bob Gailer
n initializing string in this manner? Thanks, Gilbert. ___ Tutor maillist  -  Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Bob Gailer phone 510 978 4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question about BASIC and Python

2005-08-01 Thread Bob Gailer
added anytime modules big library of modules and many more Bob Gailer phone 510 978 4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I need advice about which way to go.

2005-08-03 Thread Bob Gailer
ence. Good idea. How about now? Bob Gailer phone 510 978 4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I need advice about which way to go.

2005-08-03 Thread Bob Gailer
rdtypes[2]     else:     t1 = cardtypes[3] Why not just use the random integer as an index? If you use range(13) these if/elifs become     t1 = cardtypes[t1]     if a == 1:     a = cards[0]     playertotal = playertotal + 1     elif a == 2:     a

Re: [Tutor] What's the invalid syntax? Code supplied

2005-08-03 Thread Bob Gailer
need the rest of the code, just ask. It ran perfect before I added file I/O.   Thanks in advance, Nathan Pinno Crew, Camrose McDonalds and owner/operator of Woffee Just out of curiosity, would you explain "Crew, Camrose McDonalds and owner/operator of Woffee" Bob Gailer phone 510 978 4

Re: [Tutor] What's the invalid syntax? Code supplied

2005-08-04 Thread Bob Gailer
) but what is "Woffee"? Bob Gailer phone 510 978 4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [OT] ETL Tools

2007-04-16 Thread Bob Gailer
now what you think of this positive, neutral, negative. I'm trying to gather momentum and interest. Your response will help. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Browser based?

2007-04-17 Thread Bob Gailer
[EMAIL PROTECTED] wrote: > How can I used python online. I'm getting my hoster to install python and > I'm wondering how Do I use python online? > Could you be more specific? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tu

[Tutor] Python for CGI (was Python Browser based?)

2007-04-17 Thread Bob Gailer
Regarding using Python for CGI - Googling "python cgi" reveals many potentially useful links. These sound http://www.cs.virginia.edu/~lab2q/ www.python.org/doc/essays/ppt/sd99east/sld038.htm -- Bob Gailer 510-978-4454 ___ Tutor maillist

Re: [Tutor] raw_input into range() function

2007-04-18 Thread Bob Gailer
;Counting:" for i in range(start_num, end_num, interval): print i > > start_num == 0 > end_num == 1 > interval == 2 These are expressions that compare a variable to a constant. They contribute nothing to the program. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] StringIO and dictionaries

2007-04-30 Thread Bob Gailer
int the outputs (just for testing): > print codename > print normaloutput > print erroroutput > print codeOut > print codeErr > > And I get nothing. > Is there something I am doing wrong? Because I have read > the parts on d

Re: [Tutor] Newbie Question on Exceptions...

2007-05-08 Thread Bob Gailer
b done, is readable and maintainable. Many things can be tested for with ease. But consider when you use raw_input to get a string, and you want to accept it only if it will convert to float. The only easy way I know is to use the float() function inside a try:. If you wanted to test i

Re: [Tutor] random number guessing game

2007-05-08 Thread Bob Gailer
rs insist on it? If you don't have to include it, please consider omitting it. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Running and passing variables to/from Fortran

2007-05-09 Thread Bob Gailer
John Washakie wrote: > I have access to the source code. Did you tell us why you want to keep the code in FORTRAN? Would converting it to Python solve the issue? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org h

Re: [Tutor] were do i put the random number genorator

2007-05-10 Thread Bob Gailer
uot;,command=child3).grid(row=1,column=3) > > > /This message is intended for the addressee named and may contain > privileged information or confidential information or both. If you are > not the intended recipient please delete it and notify the sender./ > > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Why don't I see anything when I run this program?

2007-05-11 Thread Bob Gailer
___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to test for a remainder from division

2007-05-14 Thread Bob Gailer
seudocode, but have you tried to > accomplish this with the modulus operator? > It provides the remainder of integer division No, it provides the modulus, and applies to float not just integer!. For positive left argument that happens to = the

Re: [Tutor] words and lengths

2007-05-16 Thread Bob Gailer
> Emad Soliman Nawfal > University of Arizona, Tucson > http://emadnawfal.googlepages.com > > ---- > > _

Re: [Tutor] words and lengths

2007-05-16 Thread Bob Gailer
s[word, len(word)] >> >> print lengths Try this: for word in phrase2: lengths[word] = len(word) What you have now is an attempt to get a dictionary value using word, len(word) as a key and replace the dictionary with that value. Should fail with KeyError. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I want some help with arrays...

2007-05-17 Thread Bob Gailer
n't care about years outside the range 1900..2030. > you can change this when you learn the language more but it isn't recommended! > Oh? who disrecommends it? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http:/

Re: [Tutor] two input acceptions

2007-05-19 Thread Bob Gailer
;> > > Your code is unreadable and I don't have the time > or inclination to try to unpick it. Can you send as plain > text or as an attachment please? > > Alan G > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] numbers and ranges

2007-05-27 Thread Bob Gailer
_____ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] trouble with indents

2007-05-27 Thread Bob Gailer
suite     if a == 2: # statement in the while that introduces another suite     print "We hit 2" # statement in the if suite     a += 1    # statement in the while suite; if suite has ended  print "done" # while suite has ended This results in

Re: [Tutor] Creating a closed source application in Python?

2007-05-28 Thread Bob Gailer
to wade thru a several inch thick stack of assembler listings finding the code relevant to a particular problem, find the bug, and report it to the IBMers in Philadelphia. They were always accessible and responsive. BTW my mainframe terminal ran at 120 cps and printed on pa

Re: [Tutor] Command Line Promps

2007-06-03 Thread Bob Gailer
Jason Coggins wrote: > Is it possible to have a Python program issue a command line promp to > the terminal while the program is running? See raw_input() and input() built-in functions. > -- Bob Gailer 510-978-4454 ___ Tutor maillist

Re: [Tutor] Command Line Promps

2007-06-03 Thread Bob Gailer
but which OS are you running?) See os.system() and os.popen() > > Sorry if I was not more clear on this earlier, Well it is often hard to be clear, but it sure saves time and energy. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python

Re: [Tutor] python & google gear

2007-06-05 Thread Bob Gailer
gt; > Is the same feasible in pyjamas? It absolutely should be possible -- should be a simple port from the GWT work. Anyone want to take it on as a nice little project to get involved in pyjamas? James -- Bob Gailer 510-978-4454 ___ Tutor mailli

Re: [Tutor] rotation within arrays

2007-07-04 Thread Bob Gailer
t; 0 1 2 > 3 4 5 > 6 7 8 > > 11 14 17 > 10 13 16 > 9 12 15 > The mapping can be defined in another array (I'm using origin 1 indexing here): 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3 Then you'd transpose that when you transpose the other array. -- Bob Gailer 510-978-4454 O

Re: [Tutor] Key Error

2007-07-08 Thread Bob Gailer
6}, 'anotherkey': ...} Python uses braces with key : value pairs to represent a dictionary. If that does not help you, post the result (or attach if it is really long). Then we need to find how h itself was created. Any clues about that? -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Key Error

2007-07-08 Thread Bob Gailer
e a different approach: print len(h) for key in h.keys(): try: newi=h[key]['NEWI'] except KeyError: print key That will tell us how many items are in h and whether we have few or many of them that have the KeyError. -- Bob Gailer 510-978-4454 Oakland, CA

Re: [Tutor] Key Error

2007-07-08 Thread Bob Gailer
newi=h[key]['NEWI'] if wssd<-989. or wspd<-989. or wmax<-989.: break if wspd==0.: break I was suggesting you replace all of that with: print len(h) for key in h.keys(): try: newi=h[key]['NEWI'] except KeyError: print key Keep in min

Re: [Tutor] Key Error

2007-07-08 Thread Bob Gailer
d the key does not exist. > > Sorry if I'm missing something or not answering your question, I'm > highly confused! Of course you are. Going into a totally new realm with just C under your belt. If you'd like, give me a call. We migh

Re: [Tutor] writing over text

2007-07-10 Thread Bob Gailer
trailing , suppresses the newline. -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Newbie Project part 2...

2007-07-15 Thread Bob Gailer
Here's a list-based alternative: tree = [ ["You have just turned 18 years old. Your life awaits,... choices to be made..", ["Army", ["win Silver star", ["reenlist", [] # next lower level... ], ["retire", [] ]

Re: [Tutor] another question ( unrelated )

2007-07-20 Thread Bob Gailer
hread may suspend itself using one of the lock or event objects in the Threading module. It does take an external activity to end the suspension. Let's step back and ask what you want to accomplish by stopping and restarting. Perhaps there is another way to do it. -- Bob Gailer 510-978-4

Re: [Tutor] How to determine if every character in one string is in another string?

2007-07-20 Thread Bob Gailer
compares each character to ' ' and stops at the first non-printable): import itertools testString = 'aso;dkfj hado;fg ja;lsfj asl;fj jf asdl; fj\g' candidate = [x for x in itertools.takewhile(lambda x : x >= ' ', s)] if len(candidate) == len(testString): pr

Re: [Tutor] don't repeat yourself; question about code optimization

2007-07-20 Thread Bob Gailer
[]" and "count = 0", > and I would like to know if there is something I can do to avoid > repetition in this case. First fix the indentation of the line starting with "if". -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] don't repeat yourself; question about code optimization

2007-07-20 Thread Bob Gailer
[] count = 0 while count < self.max_num_of_items_per_row and self.total_num_of_items: row.append(self.total_num_of_items.pop(0)) count += 1 table.append(tuple(row)) return table -- Bob Gailer 510-978-4454 Oakland, CA 919-63

Re: [Tutor] don't repeat yourself; question about code optimization

2007-07-20 Thread Bob Gailer
table.append(tuple(self.total_num_of_items[i : i + self.max_num_of_items_per_row])) return table -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] don't repeat yourself; question about code optimization

2007-07-23 Thread Bob Gailer
[EMAIL PROTECTED] wrote: > > > On 7/20/07, *Bob Gailer* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Take advantage of slicing: >def create_grid(self): >table = [] >for i i

Re: [Tutor] don't repeat yourself; question about code optimization CORRECTION

2007-07-23 Thread Bob Gailer
A correction to the code at the end. The test of self.total_num_of_items should precede the pop(0) [EMAIL PROTECTED] wrote: > > > On 7/20/07, *Bob Gailer* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Take advantage of slicing:

Re: [Tutor] How to determine if every character in one string isinanother string?

2007-07-23 Thread Bob Gailer
so > far... > > Alan G. > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] location of points in a covariance matrix

2007-07-25 Thread Bob Gailer
t; value of - 2.3 > > This min point corresponds to the covariance between two 'lat,lon' > data points in my (41,58) sample grid. > > Is there a way i can move back from my (2378,2378) covariance matrix > to see where these two points are located on the (41, 58) grid? > > Thank you very much in advance > >

Re: [Tutor] comparing lists, __lt__ and __gt__

2007-07-25 Thread Bob Gailer
that discuss replacing or eliminating these. -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] function declaration problems perhaps?

2007-07-25 Thread Bob Gailer
scal also does it that way even though they are pure compiled > languages. In the case of Pascal it is because Pascal is designed to > be a single pass comilation language - which is why Borland's Object > Pascal comiles so quickly in Delphi! > > -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] function declaration problems perhaps?

2007-07-25 Thread Bob Gailer
does anyone else. I confess i've never looked > deeply into how Python actually does its complile/execute cycle. > Compiling to bytecode raises syntax, deprecation and indentation errors. All others AKAIK are raised during execution > Alan G. > > > __

Re: [Tutor] What exactly is [::-1]?

2007-07-26 Thread Bob Gailer
psis object. print d {(1, 2): 3, Ellipsis: 4, 313: 4} Now consider: slice_item ::= expression | proper_slice | ellipsis We took care of the cases where slice_item is expression or ellipsis. How to apply a slice_list consisting of slice_item(s) that are proper_slices to a mapping o

[Tutor] Extended slicing applied to mapping objects (was What exactly is [::-1]?)

2007-07-26 Thread Bob Gailer
Bob Gailer wrote: > Alan Gauld wrote: > >> The ref manual ... for extended slicing says: >> >> -- >> The semantics for an extended slicing are as follows. The primary must >> evaluate to a mapping object >> > d = {} >

Re: [Tutor] ideas for college app.

2007-07-28 Thread Bob Gailer
ly others also don't, as there has been no response. Could you be a lot more explicit? -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] attribute error

2007-07-28 Thread Bob Gailer
yList = [1, 3, 2] myList.sort() # returns None print myList [1, 2, 3] -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] don't repeat yourself; question about code optimization CORRECTION

2007-07-29 Thread Bob Gailer
[EMAIL PROTECTED] wrote: > > > On 7/23/07, *Bob Gailer* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > A correction to the code at the end. The test of > self.total_num_of_items > should precede the pop(0) > > > > Bob, I

Re: [Tutor] os.path.exists(path) returns false when the path actually exists!

2007-07-30 Thread Bob Gailer
still > returns false > > What am I doing wrong here ? Is there any chance the file has an extension that Windows is hiding? Can you get True for other files in the folder? -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC __

Re: [Tutor] Textual Captchas: Would like to show that bots can crack a simple text captcha

2007-08-01 Thread Bob Gailer
Kyle Brooks wrote: > Hi. > > My name is Kyle Brooks, and I hereby introduce myself with this post. > > I have seen a lot of text captchas. > I wonder how a computer program would respond to the previous sentence? Could it simulate the path I took? "captcha"? Did he mean "capture"? Is this one

Re: [Tutor] os.path.exists(path) returns false when the path actually exists!

2007-08-02 Thread Bob Gailer
uter I have to spend a lot of time undoing the initial settings so my users can get their work done! -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Editors .. which do you reccomend for a amateur?

2007-08-04 Thread Bob Gailer
Alan Gauld wrote: > AlaMode > I have googled without success. Where do I find AlaMode? -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Editors .. which do you reccomend for a amateur?

2007-08-04 Thread Bob Gailer
Lukasz wrote: > Użytkownik Bob Gailer napisał: > >> I have googled without success. Where do I find AlaMode? >> > > AlaMode is part of wxpython OK I installed wxpython. Now what do I do to run alaMode? I found no useful documentation. -- Bob Gailer 510-978-4454

Re: [Tutor] Newbie College Student

2007-08-05 Thread Bob Gailer
irst, then the actual cgi program starts with path = The only problem I see is that the code to write the file is bypassed when the path already exists. You should be able to fix that with some changes to indentation. > Been working on this two weekends in a row and th

Re: [Tutor] comparing two numpy arrays

2007-08-07 Thread Bob Gailer
, 9]) > b = array([ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) > > answer = array([ 5,6,7,8,9]) Set union? -- Bob Gailer 510-978-4454 Oakland, CA 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Checking for custom error codes

2007-08-07 Thread Bob Gailer
heck did not work anyway. Am I trying to check for this > custom error wrongly? How should it be done? > Examining rwhois.py reveals raise 'NoSuchDomain' which is a string exception. Which should work even tho deprecated. When you s

Re: [Tutor] comparing two numpy arrays

2007-08-07 Thread Bob Gailer
Eric Brunson wrote: > Bob Gailer wrote: >> Andy Cheesman wrote: >> >>> Hi people, >>> >>> If I've two numpy arrays, is there a non-looping way of finding common >>> values. (the example below has identical shapes for the arrays but this &

Re: [Tutor] Random module.. or?

2007-08-07 Thread Bob Gailer
lerA > Can score 4-45pts a game. > Most games, he scores 15-25 pts > Maybe 1 in 1000 games he scores 30 plus pts > Maybe 1 in 1 he scores 45 pts. > > The actual %'s, lengths, and pts are irrelevent,.. they are just used > to as an example. > > > Any guidanc

Re: [Tutor] Random module.. or? CORRECTION

2007-08-07 Thread Bob Gailer
Bob Gailer wrote: > Tony Noyeaux wrote: > >> As always, thanks all for the ongoing help and suggestions... the >> learning continues. >> >> I've successfully made a number of programs, making use of various >> ran

[Tutor] httplib exceptions

2007-08-08 Thread Bob Larsen
causing this problem that didn't exist until a week ago? How can I work Around this? Any Insight is greatly appreciated Bob Larsen -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] httplib exceptions

2007-08-09 Thread Bob Larsen
here is just the web page stored in memory (possibly in swap, but I doubt it) The whole situation is most frustrating. Thanks for the Advice on the Regex code. Bob -- This message has been scanned for viruses and dangerous content by MailScanner, and is

Re: [Tutor] Ingenious script (IMO)

2007-08-11 Thread bob gailer
Dick Moores wrote: > At 07:13 AM 8/11/2007, bob gailer wrote: >> Dick Moores wrote: >>> Here's the script that hands over change in the traditional way. >>> <http://www.rcblue.com/Misc/changeMakerKent_Traditional.py> >>> >>> Is there a bet

Re: [Tutor] Ingenious script (IMO)

2007-08-11 Thread bob gailer
Dick Moores wrote: > Here's the script that hands over change in the traditional way. > > > Is there a better way to handle the singulars and plurals? > What do you mean by "better"? More efficient? More readable/maintainable? Less cod

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