Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Bob Gailer
return product [snip] But as I mentioned there is no value in using decimal here. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to wrap this line of code?

2006-08-22 Thread Bob Gailer
ith number of terms of %d", print "or more was %s (%d)" % (length, intCommas(n_for_max_c), n_for_max_c) -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to wrap this line of code?

2006-08-23 Thread Bob Gailer
Dick Moores wrote: At 11:10 PM 8/22/2006, Bob Gailer wrote: Dick Moores wrote: I have this long print statement in a script: print "Initial integer of first sequence with number of terms of %d or more was %s (%d)" % (length, intCommas(n_for_max_c), n

Re: [Tutor] banners

2006-08-23 Thread Bob Gailer
S P PA M M P A M S P A M M S P A M M -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to wrap this line of code?

2006-08-23 Thread Bob Gailer
ideas! > > Dick Moores > > > > ___ > 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] What's the invalid syntax?

2006-08-23 Thread Bob Gailer
print "Go NorthEast" > k = k + 1 > else: > print "Congrats! You found the hurkle in", %d1.0, " > guesses!" (k) > break > else: > print

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

2006-08-24 Thread Bob Gailer
pt to spot the problem. Have you figured out why it is choking at the %? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help

2006-08-24 Thread Bob Gailer
x27;t use input(). use raw_input() and int(), float(), etc. > 6. don't cross-post to both the tutor and help mailing lists > and if that's not enough, please also use a more meaningful subject line, rather than "help". > ______

[Tutor] Python programming activities

2006-08-25 Thread Bob Gailer
nment - Think of ways to optimize automated solving of a puzzle rather than just brute force trial-and-error. I realize that this can go on and on. I hope this is in the ballpark of sufficient interest and somewhat easy steps. Let me knw. -- Bob Gailer 510-978-4454 _

Re: [Tutor] Python programming activities

2006-08-25 Thread Bob Gailer
Bob Gailer wrote: I amend the previous e-mail: ) this is in response to [EMAIL PROTECTED] desire for some programming assignments to work while commuting. ) "I exclude these from the following rules" refers just to rules 1 and 4. ) rule 3 - the path is vertical or horizontal, no

Re: [Tutor] File IO

2006-08-29 Thread Bob Gailer
() > > it doesnt write anything That could mean you get an empty file or you don't see the file. Which is it? If the file is empty that means puzzleanswers is empty. If you don't see the file that means it is being written someplace other than wher

Re: [Tutor] about random seed

2006-09-02 Thread Bob Gailer
equence of numbers generated will be different each time. HTH. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Looking for a few commands

2006-09-06 Thread Bob Gailer
Chris Hengge wrote: > Woohoo for my first post! > > Simple command to clear console? (C++ was something like system.clr()) > Some sort of cursor positioning? (C++ was something like gotoxy) This is operating system dependent. Which OS you use? -- Bob Gailer

Re: [Tutor] Dates

2006-09-10 Thread Bob Gailer
gt;= %s and rt_weekst <= %s and rt_type = ' % (a,b,"R") c.execute(sql) OR you could shorten it a bit: sql = 'SELECT * FROM times where rt_weekst between %s and %s and rt_type = "%s"' % (a,b,"R") I like to assign sql first, then execute it, as I can inspect sql if there is a problem. FoxPro also recognizes date constants like {12/31/2006} (note braces not parentheses). -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] quick ?

2006-09-13 Thread Bob Gailer
k] = 1 got += 1 for i in range(len(picks)+1): if picks[i]: print i, -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List manipulation

2006-09-13 Thread Bob Gailer
o do this in simple. Could > members suggest some way to solve this please. > I assume by "precedes" you mean is one-less-than. To test this you should convert the strings into integers. Since the numbers come in pairs each pair must be split at the \t (using split), then conv

Re: [Tutor] List manipulation

2006-09-13 Thread Bob Gailer
27;, '20', '25', '35', '45', '50', '55', '60', '61', '65', '75', '80'] >>> t2=[int(i) for i in t] >>> t2 [10, 15, 16, 20, 25, 3

[Tutor] How to split a file (was (no subject))

2006-09-14 Thread Bob Gailer
m the file I want to cut up. The file I want to cut up > has 3900 lines. This is as far as I have got. Others have provided the "answer". Since you are new to the list I will add the request that you provide a meaningful subject line so we can track the various threads. --

Re: [Tutor] tuples versus lists

2006-09-14 Thread Bob Gailer
pective: tuples are immutable, lists are not. One may change a list by various techniques; one may not change a tuple. tuples may be used as dictionary keys; lists may not tuples are found on the right of % (formatting); lists are not -- Bob Gail

Re: [Tutor] looping problem

2006-09-23 Thread Bob Gailer
kumar s wrote: > [snip] > so I want to select 0,3,6,9 elements into listA > and 2,5,8,11 and so on elements into listB > > Here's a hint: for j in range(0, len(biglist), 3): # this will set j = 0, 3, 6, etc. -- Bob Gailer 510-978-4454 _

Re: [Tutor] when I create an instance of a class that inherits from Python dictionary, my data disappears

2006-10-06 Thread Bob Gailer
ack (most recent call last): > File "", line 1, in -toplevel- > sdso.pop('full_name') > AttributeError: Data_Set instance has no attribute 'pop' > > Am I doing something wrong ? Err, yes. You are assuming that assigning to self.keys and self.values creates dictionary entries. All that actually does is assign the 2 lists to 2 attributes. Try instead self.update(dict_of_datum_objects). -- Bob Gailer just up the road in El Cerrito 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] float object not callable error

2006-10-12 Thread Bob Gailer
essage: 'float' object is not callable FWIW the simplest example of the callable issue is: >>> 2(3) Traceback (most recent call last): File "", line 1, in ? TypeError: 'int' object is not callable >>> 2*3 6 > > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to write strings with new line character in a file

2006-10-12 Thread Bob Gailer
ap.py", line 38, in ? > fd.write(str) > IOError: (0, 'Error') > > Please help to rectify this error... > -- > To HIM you shall return. > > > ___

Re: [Tutor] How to write strings with new line character in a file

2006-10-13 Thread Bob Gailer
is inadvisable to change the file position or to read it ( as you are doing). As Kent points out there are better ways to do what you are doing. My (minimalist?) version is: fname = raw_input("Enter the file name to write data to:\t") fd = open(fname,'a+') names = set() whil

Re: [Tutor] How to write strings with new line character in a file OOPS CORRECTION

2006-10-13 Thread Bob Gailer
Bob Gailer wrote: > Asrarahmed Kadri wrote: > >> Here is the complete code: >> fd is the file handle. >> >> import sys >> >> def check_dup(fd1): >> print fd1 >> fd1.seek(0,0) >> done = 0 >> list1 = [] &g

Re: [Tutor] A puzzle for you

2006-10-14 Thread Bob Gailer
the argument of random.choice is supposed to be a sequence (according to the docs str, unicode, list, tuple, buffer, xrange), I'd expect an exception. I also predicted the the result if no exception was raised, and that was correct. I will withhold further observation until others (who wi

Re: [Tutor] A puzzle for you

2006-10-17 Thread Bob Gailer
you have built a dict of 1000 items with keys between 1 and 1000, all values 0. Then you have give choice 693 tries to pick a key value other than 0. One 0 raises a key not found exception. No 0s raises no exception and the expression returns 0. -- Bob Gailer 510-978-4454

Re: [Tutor] Resources for Tkinter...

2006-10-19 Thread Bob Gailer
"To HIM you shall return." > > Do you have any suggestions for a nice book or web resource..?? > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] need some class / module help

2006-10-20 Thread Bob Gailer
t an easier way to code something very long later. Just wanted to know if i am on the right track. if you have read this far, thanks ! sk _______ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/

Re: [Tutor] Why is this only catching one occurance?

2006-10-27 Thread Bob Gailer
There are several ways around this. The easiest is to process the list backwards: for unWantedItem in directoryList[,,-1]: -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I am terribly confused about "generators" and "iterators".. Help me

2006-10-27 Thread Bob Gailer
at this thought brings you some comfort or stimulation. I used to believe something similar, and all it did was bring me fear guilt and shame. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] line number when reading files using csv module

2006-10-27 Thread Bob Gailer
test_read_linenum(self): > r = csv.reader(['line,1', 'line,2', 'line,3']) > self.assertEqual(r.line_num, 0) > > I suspect this is something so obvious that I just can't see the > wood for the trees and I will kick myself.

Re: [Tutor] line number when reading files using csv module

2006-10-27 Thread Bob Gailer
Duncan Gibson wrote: > [snip] > but I would like to record the line number in the file. > How about using enumerate(): > > for line_num, data in enumerate(reader): > print reader.line_num, data > > --

Re: [Tutor] line number when reading files using csv module CORRECTION

2006-10-27 Thread Bob Gailer
Bob Gailer wrote: > Duncan Gibson wrote: > >> [snip] >> > > >> but I would like to record the line number in the file. >> >> > How about using enumerate(): > >> for line_num, data in enumerate(reader)

Re: [Tutor] Adding voting to several object in python and db

2006-10-28 Thread Bob Gailer
u. If you don't get any useful replies, please explain the desired behavior. > > thanks a lot for your time and patience > > keep rockin in the web/python world > > > Anil -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] First realscript + Game of Life

2006-11-11 Thread Bob Gailer
Also if you told a "binary" person that his base was 2 he could not understand that. To him it is base 10 -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] (no subject)

2006-11-13 Thread Bob Gailer
some code and tell us what you were expecting. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Not able to store result between function call.. Help needed

2006-11-13 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] sleep command in python?

2006-11-14 Thread Bob Gailer
n time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal's catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system.&q

Re: [Tutor] a question about passing values between functions

2006-11-17 Thread Bob Gailer
= area * price > 19 print "The cost of the pizza is %0.2f" > %(cost) > 20 > 21 unitCost() > --- If I were working this assignment I'd structure it thus: get the diameter get the cost per square inch call a function to compute the

Re: [Tutor] Rotating an array?

2006-11-19 Thread Bob Gailer
The OP (whose email address I don't have) requested a 90 degree ccw roatation. transposed = zip(*twisted) # gives the 90 degree cw roatation transposed.reverse() # does the 180 degree rotation leaving us at 90 degreee ccw -- Bob Gailer 510-978

Re: [Tutor] Help with the following code..

2006-11-23 Thread Bob Gailer
) is the top left corner, and (x1, y1) is the bottom right corner." I highly advise you get a reference. The Tkinter module document under the Python Manuals - Global Module Index lists several. BTW how can you write code without a reference? Are you copying examples? -- Bob Gailer 510

Re: [Tutor] Help with the following code..

2006-11-23 Thread Bob Gailer
Alan Gauld wrote: > I think he has a reference but just couldn't see how you could draw > a 4 cornered shape with only two corners specified. > And I assumed no reference, since references usually spell out the meaning of parameters. -- Bob Gaile

Re: [Tutor] program spontaneously closes...

2006-11-25 Thread Bob Gailer
dth is" > print width > print " " > print "So the area is" > print area > print " " > > end = (raw_input("Type something, and press Enter, and the program > should shut down.")) > #workaround > > > > > ___ > 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] Convert string to file handle

2006-11-27 Thread Bob Gailer
to run this entire process within the physical memory! Depends on what for. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Modulo operator (was no subject)

2006-11-28 Thread Bob Gailer
he documentation says, the modulo operator does not return a remainder! Notice: >>> [x % 3 for x in range(-5,5)] [1, 2, 0, 1, 2, 0, 1, 2, 0, 1] For negative values of the left argument the result is NOT the remainder. The literature seems very confused about this, using "rem

Re: [Tutor] Modulo operator (was no subject)

2006-11-28 Thread Bob Gailer
See http://en.wikipedia.org/wiki/Modular_arithmetic for a comprehensive discussion. Especially the paragraph title Remainders. Often people ask "what's the practical use of modular arithmetic?" Consider how we tell time... -- Bob Gail

[Tutor] Game programming - inventory management (was Help)

2006-11-28 Thread Bob Gailer
lso if not too much trouble then how can i do: > > IF the user picks the bat up then when he comes across the vampire > then he kills it, but if he hasnt pickd up the bat then he dies? > > Thanks in advance > > P.S. Could u plz email sum code > ----

Re: [Tutor] Integer?

2006-12-15 Thread Bob Gailer
>> >> >> >> -- >> Eli Zabielski >> > > > ___ > 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] Lists on the fly?

2006-12-22 Thread Bob Gailer
r: > > for i in range(5): > lista_+'%i' % (i) = [] > > :-[ > > Is this possible? > > Thanks in advance, > And Merry Christmas, > Carlos > > > ___ > Tutor maillist - Tutor@python.org > http://mail.pyt

Re: [Tutor] Lists on the fly?

2006-12-22 Thread Bob Gailer
following the logic in how > the key, the actual word, is having a value assigned. > counter[w] = 1 # if w is not a key in the dictionary, this assignment adds it, with a value of 1 > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Lists on the fly?

2006-12-22 Thread Bob Gailer
Steve Oldner wrote: > Thank you! I makes sense now and shows me I need to research more on > file methods. Good. One other advisory: don't use file as a variable name. file is a built-in function; reassigning it makes the function unavailable. -- Bob Gailer 5

Re: [Tutor] hi, learning python

2006-12-24 Thread Bob Gailer
Guesses you've taken: 0 > Guess letter: (letter would go here) > > instead of > > Guesses you've taken: 0 > Guess letter: > (leter you've taken) > > is there a way to continue the input line, like in java you would just do > System.out.print? >

Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Bob Gailer
t > > ___ > 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] Starting python from a DOS prompt from any directory?

2007-01-01 Thread Bob Gailer
gt; > ___ > 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] Converting a string to a list with each character as an item

2007-01-11 Thread Bob Gailer
Amadeo Bellotti wrote: > does anyone know how to do this? I need it because i want to make a > binary coverter >>> list('abc') ['a', 'b', 'c'] -- Bob Gailer 510-978-4454 ___ Tutor maillist - T

Re: [Tutor] Problems with a Class

2007-01-12 Thread Bob Gailer
gt; > Hopefully I'm making myself clear and the info is enough. > Unfortunately, no. I for one can't interpret "I need the info every time that it gets updated by the loop". -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Staring myself blind

2007-01-20 Thread Bob Gailer
at causes the problem? Or have any tips how to find > the error easily? > > Thanks in advance! > Toon Pieton > > > _______ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > --

Re: [Tutor] Inputting elements of a list

2007-01-22 Thread Bob Gailer
#x27;) > Traceback (most recent call last): > File "", line 1, in ? > int('1000') > TypeError: 'int' object is not callable > > > HTH, > -Luke > ___ > 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] curious struct problem

2007-02-02 Thread Bob Gailer
e.read(sz) >infile.close() > > #struct.error: unpack str size does no match format > > > > _______ > 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] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Bob Gailer
nusual. > > This should be corrected, don't you think? > Who is the publisher? They'd be the ones to correct this. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Bob Gailer
libraries, universities, wholesalers and distributors." IMHO the revision should be considered a new edition therefore have a new ISBN. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python referrence

2007-02-09 Thread Bob Gailer
left side the "usual" Contents Index Search Favorites Tabs. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] telnet read_until problems

2007-02-12 Thread Bob Gailer
owing >>> print data is the packet capture, and the 2 lines following "yields:" is the subset of the packet capture that comes into self.data. Is this true? If so are you asking why self.tn.read_until(self.host.upper() + "#", 7) does not get all the packet? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Bob Gailer
s where some inspection / protection / side-effect action is desired. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Visual Basic versus Python.. What to choose??

2007-02-20 Thread Bob Gailer
te server? Size? Transaction rate? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Function for converting ints from base10 to base2?

2007-02-21 Thread Bob Gailer
#x27;,'0010','0011','0100','0101', '0110','0111','1000','1001','1010','1011','1100', '1101','1110','')): return " ".join( [bin[x]+bin[y] for x,y in [divmod(ord(c),16) for c in s]]) Note that by making bin a parameter it gets created one time when the def is executed. And indexing a list is faster than keying a dict. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] storing text in databases

2007-02-21 Thread Bob Gailer
atabase. If you do not need to run queries against the document contents, consider that approach. If you need to query contents consider building indexes of keywords rather than asking a database to find rows where document like "?dollar?" (or is is % ?) > - Is this a good id

Re: [Tutor] Explanation of this lambda

2007-02-21 Thread Bob Gailer
range(count-1, -1, -1])    or if you are using the latest python use a generator _expression_: "".join(str((x>>y)&1) for y in range(count-1, -1, -1) -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Explanation of this lambda CORRECTION

2007-02-21 Thread Bob Gailer
Bob Gailer wrote: I just noticed missing ) in the last 2 statements. Fixed below. Johan Geldenhuys wrote: Hi all,   I found this function that converts a integer into a 8 bit binary string.   Would somebody care to explain what is happening in this process

Re: [Tutor] How many loops does "break" jump out of?

2007-02-22 Thread Bob Gailer
one with return, and put a call to the function in place of the code. def tests(): if test_1: etc etc if test_4: return Some may take issue with that. You can, as Alan says, restructure the code, or use intermediate variables. -- Bob Gailer 510-978-4454 ___

Re: [Tutor] Programming the behavior of a set of domino

2007-02-23 Thread Bob Gailer
; membership (i.e. x in list) is not working because they are not a > exact duplicates. > To create only unique dominoes: for a_end in range(self.set_type+1): for b_end in range(a_end, self.set_type+1): self

Re: [Tutor] List and comprehension questions

2007-02-25 Thread Bob Gailer
)) for di, dv in dict1.iteritems()) > >> 3. Last but not least. I understand the replacement in #2 above is the >> proper Pythonic idiom, but what if a list isn't being created. Is it >> considered properly idiomatic to replace >> for li in list1: >>

Re: [Tutor] Another list comprehension question

2007-02-26 Thread Bob Gailer
t; > files = list() > Or just files = [] > for clist in get_clists(): > files += get_clist(clist) > > My first attempt was to try > [get_clist(c) for c in get_clists()] > > but this returns a list of lists rather than the flat list from the > original. > &

Re: [Tutor] Another list comprehension question

2007-02-26 Thread Bob Gailer
John Fouhy wrote: [snip] > > Or [x for k in get_clists() for x in get_clist(k)] using your original > structure. > Well I learned something! -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

Re: [Tutor] Module search path problem

2007-02-27 Thread Bob Gailer
t's up with this? > Kent gave the answer for this case. In general use the __file__ attribute of the module object to see what was actually imported. In your case: print user.__file__ -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] howto call DOM with python

2007-02-28 Thread Bob Gailer
rted GWT widgets is pretty impressive. No more HTML! Take a look at the pyjamas helloworld example. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Can you tell me if this C or python please

2007-03-02 Thread Bob Gailer
but I am confused by some of > the code in it. I would appreciate it if someone could look at the file > for me and tell me if it is c so I can pass it back to the c guys and > ask them. > OK. Show us the file (if not too big as body te

Re: [Tutor] forth

2007-03-02 Thread Bob Gailer
nt, and novel. It's a novel language. VERY >> good for controllers giving you maximum program in a small device such >> as your usuall PIC chip. Really SHINES in this venue. >> >> Here's a link to wikipedia: >> http://en.wikipedia.org/wiki/Forth_(programming_language) >> >> But this is python list, so enough of comparitive languages. >> > > -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Can you tell me if this C or python please

2007-03-02 Thread Bob Gailer
Lance Haig wrote: > Bob Gailer wrote: >> Lance Haig wrote: >>> Hi, >>> >>> I am helping on an OS project called bongo-project and I am trying >>> to debug a script that is used for migration. When I run the file I >>> get an error. I have

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Bob Gailer
les make perfect sense. This one doesn't, and > appears to be an inconsistency: > > >>> word2 = 'hello' > >>> item = 'e' > >>> item in word2 > True > >>> item == item in word2 > True > Take a look in 5.9 C

Re: [Tutor] Roman Numeral to Digital

2007-03-08 Thread Bob Gailer
I examine each roman numeral character in turn starting at the left (or right?): for rc in roman_input: I lookup the character's decimal value (note there are several ways to do this in Python - the "best" is a dictionary), an if elif else statement, I add it to the digital_result etc. Hope that gets you started. Write all the manual steps. Make sure each is one simple operation. Walk thru the steps to verify that you have them correct. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Digital-to- Roman (pseudocode)

2007-03-08 Thread Bob Gailer
Alan Gilfoy wrote: > Quoting Bob Gailer <[EMAIL PROTECTED]>: > > >> Make sure each step >> is one simple operation. Walk thru the steps to verify that you have >> them correct. >> > > Bob, your email did inspire me on how I would express

Re: [Tutor] Roman to digital (pseudocode)

2007-03-13 Thread Bob Gailer
add the decimal value and step to the next letter. Else take the leftmost letter of that pair If it is in the dictionary add the decimal value and step to the next letter. Else complain about bad letter -- Bob Gailer 510-978-4454 ___

Re: [Tutor] pruning and ordering a list of lists

2007-03-23 Thread Bob Gailer
sted # assume your data is in variable log: userData = {} # setup a dictionary to collect latest timestamp for each user for user, timestamp in log: if user not in userData or timestamp > userData[user] # note that we need a way to compare timestamps # the current representation does not

Re: [Tutor] Filesystem vs Database vs Lucene

2007-03-28 Thread Bob Gailer
Shitiz Bansal wrote: > > I need to implement a system which stores Strings(average length 50> > chars). [snip] How much greater than 50? 500, 5000, 50,000, ...? Are these arbitrary text, or do the words come from some predetermined domain? Would you provide some examples? -- Bo

Re: [Tutor] Filesystem vs Database vs Lucene OOPS

2007-03-28 Thread Bob Gailer
Bob Gailer wrote: Shitiz Bansal wrote: I need to implement a system which stores Strings(average length 50> chars). [snip] I may have read 50> as >50. Please confirm that average length IS 50? Are these arbitrary text, or do the w

Re: [Tutor] A string-manipulation question

2007-03-29 Thread Bob Gailer
o index the string by word, as opposed to the standard method > of strings being indexed by character. > "I would like to convert an English string (sentence) into Pig Latin.".split() yields: ["I", "would", "like", &qu

Re: [Tutor] [OT] ETL Tools

2007-03-30 Thread Bob Gailer
is is proving to be > a little slow with the amount of data we now have, so I am looking > into alternatives. > > Does anyone have any experience of this sort of thing? Or know > someone who does, that I could talk to? > > -- Bob Gailer 510-978-4454

Re: [Tutor] A string-manipulation question

2007-03-30 Thread Bob Gailer
<http://en.wikipedia.org/wiki/Vowel> sounds (including silent consonants <http://en.wikipedia.org/wiki/Silent_letter>), simply add the syllable "ay" to the end of the word. * eagle → /eagle-ay/ * America → /America-ay/ * honor → /honor

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Bob Gailer
exec is the statement for doing this, but the need to do this can always be met better by using a dictionary instead of global variables. -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Bob Gailer
han an exec-solution, since I > don't need security checks for the string that is saved, before > executing it. I'd love to help, but am confused. If your code (at least the relevant part) is of reasonable size, would you post it? Or at least some pseu

Re: [Tutor] how to split a stream of chars

2007-04-09 Thread Bob Gailer
ly it to your problem thus: import pipeline result = pipeline.pipe('deblock 2', '00010203040506...') Does this interest you? (The capabilities of Pipelines is MUCH bigger than this example!) Would you like to be an alpha tester of this tool? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Begining Python

2008-03-11 Thread bob gailer
Meftah Tayeb wrote: > 1. do you know a tutorial for this ? This tutor list is also a good place to ask questions. > 2. do you know a Free IDE for Python (for windows) ? Many of us really like http://sourceforge.net/projects/pywin32/ -- Bob Gailer 919-636-4239 Chapel Hi

Re: [Tutor] hypotenuse

2008-03-14 Thread bob gailer
raceback. Otherwise we have no way to easily help you. But I will take a guess that you saved the contents of the interactive session and tried to run that. That will not work, as the interactive session is full of >>> and results of print statements. So I suggest you edit the module t

Re: [Tutor] Converter

2008-03-19 Thread bob gailer
input = feet then do this equation. I am coding in pure > Python on my mac, so please nothing in C as have been some answers I have > received. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] CSV file processing...

2008-03-20 Thread bob gailer
,. item2, ... item20, data21, data22, ... data27 -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] More Converter

2008-03-22 Thread bob gailer
(to, original)] print variable / factor Adding key testing: if (original, to) in factors: factor = factors[(original, to)] print variable * factor elif (to, original): factor = factors[(to, original)] print variable / factor else: print "no conversion available for %s t

Re: [Tutor] suggestion on improving script

2008-03-23 Thread bob gailer
gt; ### > > I would like to alter this batch control so that I don't have to create > a new method everytime I need a new tab. > > For example, I would like to change t1, t2 ... t[n] depending on the tab > I am at. > > You can see it in action at http://uk.expert.travel/;vi

Re: [Tutor] I am reading the tutorial alright?

2008-03-23 Thread bob gailer
roblems yourself and express questions CLEARLY! -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

<    3   4   5   6   7   8   9   10   11   12   >