Re: [Tutor] Windowss sidebar gadgets with Python?

2008-01-09 Thread Michael Langford
#x27;ve ever seen, but it looks possible. --Michael PS: I've had notes on this for awhile, but haven't had the time to try. If it works, let me know. On 1/9/08, Timothy Sikes <[EMAIL PROTECTED]> wrote: > > Hello all. > > I have been working with Python for a couple years of

[Tutor] Urgent: Help

2008-01-07 Thread Michael H. Goldwasser
u through these problems. He or she is best qualified to know your current level and the context for such a homework assignment. Of course, reading the book is also likely to help. For everyone else, if you like these exercises there are 300 more where they came from. ;-) With

Re: [Tutor] classes and the deepcopy function

2008-01-06 Thread Michael
Okay Just when I think I am getting it you throw this in. So why does a become local to each variable but b seem global? Michael bob gailer wrote: > Michael wrote: >> Hi Michael >> >> Thanks for the quick reply, I think I get it. So becuase I did not >> declare t

Re: [Tutor] classes and the deepcopy function

2008-01-04 Thread Michael
Hi Michael Thanks for the quick reply, I think I get it. So becuase I did not declare them withing the init method using self they are shared by every object that is created, even completely brand new ones? Is it normal practice to declare your variables in a class? I notice that you don&#

[Tutor] classes and the deepcopy function

2008-01-04 Thread Michael H. Goldwasser
Hi Michael, This is a very interesting example. You do indeed have two distinct copies. The interdependence you are observing is because you have defined CLASS-LEVEL variables (akin to static in Java) rather than instance-level variables. This is because of their declaration within

[Tutor] classes and the deepcopy function

2008-01-04 Thread Michael
changes as well. Can anyone give ma a pointer? Thanks Michael -- import copy class point: "represents a point in 2d space" x = 0 y = 0 def printpoints(self): print "x is %g, y is %g" %(self.x, self.y) class rectangle: &qu

[Tutor] Tkinter OptionMenu question

2008-01-04 Thread Michael Schultz
Hello list! I was wondering if any of you could help me with this: I've got a small GUI connected to a SQLite DB. My OptionMenu pulls a category list from the DB, and there's a field to add a new Category if you need to. Now, I'd like the have the OptionMenu update with the new category after the

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Michael Bernhard Arp Sørensen
ye) It took me a couple of minutes to understand your challenge. :-) Then I remembered that "ui" is instantiated inside "g" and therefore callable with the right parameter. Thank you very, very much. I enjoy a good challenge. -- Med venlig hilsen/Kind regards Michael

Re: [Tutor] Choice of GUI builders

2008-01-02 Thread Michael Langford
out. I don't think I understand your concern enough to address it. Are you worried about reliability? Error checking? What in particular? Perhaps you could cut and paste a bit of code you've already written that you think would be complicated by the Async? --Michael On Jan 2

Re: [Tutor] Choice of GUI builders

2008-01-02 Thread Michael Langford
Windows, Linux, Mac, Firefox, IE6, IE7 and Opera, makes this a great choice for a easy UI toolkit. --Michael On Jan 2, 2008 9:08 AM, Roy Chen <[EMAIL PROTECTED]> wrote: > Hello all, > > I've been using PythonCard to build a GUI for a simple program I'm trying to &

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Michael Bernhard Arp Sørensen
nks a lot for this test of my humility and for your effort. -- Med venlig hilsen/Kind regards Michael B. Arp Sørensen Programmør / BOFH I am /root and if you see me laughing you better have a backup. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Learning about callbaks

2008-01-02 Thread Michael Bernhard Arp Sørensen
wanted to understand how a "parent" object could send a callback to a "child" object, and now I got it. Feel free to comment on this, please. Thank you for your patience, Alan. -- Med venlig hilsen/Kind regards Michael B. Arp Sørensen Programmør / BOFH I am /ro

Re: [Tutor] Displaying images on a web page

2008-01-01 Thread Michael Langford
m your python backend). If you're really trying to avoid writing your own HTML out, the table example from GWT( http://gwt.google.com/samples/KitchenSink/KitchenSink.html#Panels) will do what you're looking for. Pyjamas(http://code.google.com/p/pyjamas/) will generate GWT code from pyt

Re: [Tutor] Learning about callbaks

2008-01-01 Thread Michael Bernhard Arp Sørensen
1(x): >print 'f1: %s' % x > >def f2(x): >print 'f2: %s' % x > >def use_them(funcs): >for func in funcs: >func('abcd') > >def test(): >funcs = [f1, f2] >use_them(funcs) &

Re: [Tutor] Learning about callbaks

2007-12-29 Thread Michael Bernhard Arp Sørensen
vor On Dec 29, 2007 6:39 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Michael Bernhard Arp Sørensen" <[EMAIL PROTECTED]> > wrote > > > I want to learn about callbacks because we use it at work in our > > software. > > Can you be more specific

[Tutor] Learning about callbaks

2007-12-29 Thread Michael Bernhard Arp Sørensen
Hi there. I want to learn about callbacks because we use it at work in our software. I there a short "hello world"-like version of a callback example? -- Med venlig hilsen/Kind regards Michael B. Arp Sørensen Programmør / BOFH I am /root and if you see me laughing you better hav

Re: [Tutor] Careful Dictionary Building

2007-12-28 Thread Michael Langford
: mydict[ record[0] ].append( record ) defaultdict is usually good enough for datasets I've used it for. --Michael On 12/28/07, doug shawhan <[EMAIL PROTECTED]> wrote: > > *sigh* Ignore folks. I had forgotten about .has_key(). > > > > On Dec 28, 2007 11:22 AM, d

Re: [Tutor] Closing GUI program

2007-12-28 Thread Michael H. Goldwasser
operating system. Some interesting reading is at http://www.3dartist.com/WP/python/tknotes.htm With regard, Michael --- from Tkinter import Tk,Label def onClose(): root.destroy() # stops the main loop and interpreter root = Tk() roo

[Tutor] Dynamically named objects

2007-12-27 Thread Michael Bernhard Arp Sørensen
hello world") Can this be done? If not, is there a work around or some design pattern for this situation? -- Venlig hilsen/Kind regards Michael B. Arp Sørensen Programmør / BOFH I am /root and if you see me laughing you better have a backup. ___

Re: [Tutor] PythonCard error checking

2007-12-24 Thread Michael Langford
ted into its own files: to keep the hair out of your main program. --Michael On Dec 24, 2007 10:02 AM, Roy Chen <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I've just started trying PythonCard to build a simple GUI for a little > application I'm writing. >

Re: [Tutor] Regular Expression

2007-12-21 Thread Michael Langford
You need to pass a parameter to the string in the following line: outfile.write("%s\n" % m.string[m.start():m.end()]) And you need to use m.search, not m.match in the line where you're actually apply the expression to the string m = patt.search(line) --Michael On 12/2

[Tutor] Regular Expression

2007-12-21 Thread Michael H. Goldwasser
patt = re.compile(r"~02(\d*)~") Also, your outfile.write command below doesn't provide any substitute for %s. Presumably you mean outfile.write("%s\n" % m.group(1)) . Good luck, Michael On Friday December 21, 2007, Que Prime wrote: >I need to pull the highligted d

Re: [Tutor] XML data reading

2007-12-20 Thread Michael Langford
from amazon. urlib2 and sax parsers are formidable, quick technologies to perform simple parsing needs. Look into BeautifulSoup as well: http://www.crummy.com/software/BeautifulSoup/ --Michael On Dec 20, 2007 4:15 PM, Lockhart, Luke <[EMAIL PROTECTED]> wrote: > &g

[Tutor] Application Tutorials

2007-12-18 Thread Michael Schultz
Hello everyone. I'm one of those people stuck in that odd space between total noob and partially competent :) What I'm looking for are nicely structured intermediate tutorials that focus on creating actual applications, even if fairly useless :) But mainly something that can give me an understand

Re: [Tutor] Bound To Be A Typo

2007-12-17 Thread Michael Langford
Its "under under", not "under under under" before and after init --Michael On 12/17/07, earlylight publishing <[EMAIL PROTECTED]> wrote: > Okay I copied this code directly from a book (author Michael Dawson) and > it's not working. I'm s

[Tutor] Bound To Be A Typo

2007-12-17 Thread Michael H. Goldwasser
You've inadvertently used three underscores around __init__ rather than two, and therefore you are not really defining __init__ but instead are relying upon the inherited one from object (which takes no parameters). With regard, Michael On Monday December 17, 2007, earlylight publishing

Re: [Tutor] python links

2007-12-16 Thread Michael Langford
academic project to boot. If you are going to go with a processor on which you can embed Linux, there is a python in the buildroot tree, however buildroot can be quite the crap shoot, depending on processor and mix of applications (It didn't work on the last board I was using

[Tutor] what is the difference

2007-12-13 Thread Michael H. Goldwasser
. else: return With regard, Michael On Thursday December 13, 2007, johnf wrote: >if self._inFlush: > return >self._inFlush = True > > >AND > >if not self._inFlush: > ... > self._inFlush = True >else:

Re: [Tutor] Python Versions

2007-12-12 Thread Michael Langford
ques can do that, so its all hunky dory. Try each though, they'll make you learn something you didn't know, at least how to talk to the other types of Geek. --Michael On 12/13/07, earlylight publishing <[EMAIL PROTECTED]> wrote: > Actually the first thing I noticed is the

Re: [Tutor] python and interface duplex checks

2007-12-12 Thread Michael Langford
be done with python. Or you can just parse the ifconfig output. --Michael On 12/12/07, Robert Recchia <[EMAIL PROTECTED]> wrote: > > > On Dec 12, 2007 11:01 PM, Michael Langford <[EMAIL PROTECTED]> > wrote: > > Most easily: If your card supports ethtool, you

[Tutor] python and interface duplex checks

2007-12-12 Thread Michael Langford
#x27;t reply back to the list and I'll delve into the older mii-tools to tell you which one to hack on. --Michael On Dec 12, 2007 9:48 PM, Robert Recchia <[EMAIL PROTECTED]> wrote: > I was wondering can python can be used to check the duplex settings of a > networ

Re: [Tutor] python and interface duplex checks

2007-12-12 Thread Michael Langford
#x27;t reply back to the list and I'll delve into the older mii-tools to tell you which one to hack on. --Michael On Dec 12, 2007 9:48 PM, Robert Recchia <[EMAIL PROTECTED]> wrote: > I was wondering can python can be used to check the duplex settings of a > networ

Re: [Tutor] How is "tuple" pronounced?

2007-12-10 Thread Michael Langford
Tuple, rhymes with "you pull" --Michael On 12/10/07, earlylight publishing <[EMAIL PROTECTED]> wrote: > Is it tuh-ple (rhymes with supple) > > or is it two-ple (rhymes with nothing that I can think of)? > > Please visit our websi

[Tutor] Timed While Loops and Threads

2007-12-08 Thread Michael H. Goldwasser
numSeconds, 'seconds, you scored', score, 'points.' +--- | Michael Goldwasser | Associate Professor | Dept. Mathematics and Computer Science | Saint Louis Unive

Re: [Tutor] Use of sqrt() from math module

2007-12-01 Thread Michael H. Goldwasser
th.sqrt is likely due to an attempt to take the square root of a negative number (presumably because your (ypos - 384 * 160) factor is negative. With regard, Michael On Saturday December 1, 2007, Matt Smith wrote: >Matt Smith wrote: >> import sys, pygame, math >> >

Re: [Tutor] parsing a continuous log file

2007-11-29 Thread Michael H. Goldwasser
uot;do what you want with", line else: # currently at end of file time.sleep(1) # don't want to poll too quickly Good luck, Michael On Friday November 30, 2007, Alan Gauld wrote: > >"ray sa" <[EMAIL PROTECTED]> wro

Re: [Tutor] Variables and Functions

2007-11-28 Thread Michael H. Goldwasser
With regard, Michael class Sudoku: def __init__(self): self.puzzle = [[1,2,3,4,5,6,7,8,9], [4,5,6,7,8,9,1,2,3], [7,8,9,1,2,3,4,5,6], [2,3,4,5,6,7,8,9,1], [5,6,7,8,9,1,

Re: [Tutor] List processing question - consolidating duplicate entries

2007-11-27 Thread Michael Langford
his included. Do not use a database, that would be very ugly and time consuming too. This is cleaner than the dict keys approach, as you'd *also* have to convert to tuples for that. If you need this in non-list completion form, I'd be happy to write one if that's clearer to you o

Re: [Tutor] pipeline - what is it and how do I use it?

2007-11-25 Thread Michael Langford
but should work) while not os.path.isfile("/var/jobs"): datafile = file("/var/jobs") map(myFileProcessingFunc,datafile.readlines()) datafile.close() os.remove("/var/jobs") -- Michael Langford Phone: 404-386-0495 Consulting: http://www.RowdyLabs.com __

Re: [Tutor] network - send one line of text

2007-11-23 Thread Michael Langford
your problem. If you're on a unix-like OS, use netcat: http://netcat.sourceforge.net/ --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.RowdyLabs.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Web programming

2007-11-17 Thread Michael Langford
what errors mean when you're trying to get it up and going: http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking I was amazed how helpful that second page was on setting things up. I think it took me about 20-25 min. --Michael On Nov 17, 2007 12:14 PM, Dinesh B Vadh

[Tutor] repeat

2007-11-17 Thread Michael H. Goldwasser
On Saturday November 17, 2007, Michael wrote: >Hi All > >This has probably been asked before but can I get some clarification on >why Python does not have a repeat...until statement, and does that mean >repeat...until is bad practice? I was trying to ge

[Tutor] repeat

2007-11-16 Thread Michael
langauge must have a test last structure in it to be considered. Thanks Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Little subclass understanding problem

2007-11-15 Thread Michael H. Goldwasser
example is certainly not a proper use of inheritance. With regard, Michael On Thursday November 15, 2007, Michael H. Goldwasser wrote: > >On Thursday November 15, 2007, Tom wrote: > >>I am trying to understand what happens in the following scenario: >>

[Tutor] Little subclass understanding problem

2007-11-15 Thread Michael H. Goldwasser
lass Set(list): def __init__(self, value = []): list.__init__([]) self.concat(value) # copies mutable default That fourth line uses a custom method defined later to insert designated values into the set while making sure to avoid

Re: [Tutor] manipulating data

2007-11-15 Thread Michael H. Goldwasser
t() # I've left this here, but not sure # why you have it. The for loop # already advances from line to line Note as well that it is better to perform the split once per line (rather than recomputing it as you do in your or

Re: [Tutor] global is bad but ...

2007-11-13 Thread Michael H. Goldwasser
other array. In this sense, the code is not reusable. If it accepted G as a parameter, then it would be more general. The main advantage of globals is convenience (for example, if all you care about is getting this particular program working as soon as possi

[Tutor] assignment question

2007-11-11 Thread Michael H. Goldwasser
On Sunday November 11, 2007, Ryan Hughes wrote: >Hello, > >Why does the following not return [1,2,3,4] ? > >>>> x = [1,2,3].append(4) >>>> print x >None The reason is that the append method does not return anything. In effect, the expresison [1,2,3].append(4) tempo

[Tutor] Problem with default arguments for function

2007-11-11 Thread Michael H. Goldwasser
t;> print fact(50, None) 30414093201713378043612608166064768844377641568960512 With regard, Michael On Sunday November 11, 2007, Dick Moores wrote: >def fact(n, precision=15, full=False): > """ > compute n! > """

Re: [Tutor] New Introductory Book

2007-11-08 Thread Michael H. Goldwasser
tact our publisher today so that we can get full source code from the entire book up on their website. I'm not sure of their willingness for a sample chapter, but will ask about that as well. With regard, Michael +-------

[Tutor] From Numpy Import *

2007-11-07 Thread Michael H. Goldwasser
namespace. If you were using some other package that also defined an "array" and then you were to use the "from numpy import *", the new definition would override the other definition. The use of qualified names helps to avoid these collisions and makes clear where those def

Re: [Tutor] New Introductory Book

2007-11-06 Thread Michael H. Goldwasser
eview copies to educators and sending representatives to campuses. In any event, we believe that the book can be quite useful outside the traditional classroom for new programmers or those new to object-oriented programming. Best regards, Michael On Tuesday November 6, 2007, jay wrote: >

[Tutor] New Introductory Book

2007-11-06 Thread Michael H. Goldwasser
We are pleased to announce the release of a new Python book. Object-Oriented Programming in Python by Michael H. Goldwasser and David Letscher Prentice Hall, 2008 (available as of 10/29/2007) The book differs greatly from existing introductory Python books as it

Re: [Tutor] Sorting specific files by modification date

2007-11-05 Thread Michael Langford
In psudocode: #map the files to their time. filesByTimes = {} for each in filesInDirectory: filesByTimes[os.stat(each).st_mtime]=each #find the largest time times = filesByTimes.keys() sort(times) #retrieve the file that goes with it latestFile = filesByTimes[times[-1]] --Michael On

Re: [Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Michael Langford
You don't need an atomic read and write, you need a blocking file lock mechanism. This page explains them and how to use them: http://www.voidspace.org.uk/python/pathutils.html#file-locking --Michael On 11/4/07, Tom <[EMAIL PROTECTED]> wrote: > > Hi, > > I am tryin

Re: [Tutor] List comp question

2007-11-03 Thread Michael Langford
func_once_cleanup(print_and_return_big_list) print_and_return_big_list( On 11/2/07, Michael Langford <[EMAIL PROTECTED]> wrote: > > Decorate level2 with a decorator that caches: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425445 > > --Michael > >

Re: [Tutor] List comp question

2007-11-02 Thread Michael Langford
Decorate level2 with a decorator that caches: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425445 --Michael On 11/1/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > I am building a list like this: > > tree = [] > for top in tops: >

Re: [Tutor] Automating operations... os module, mysql operations, more...

2007-11-01 Thread Michael Langford
, Jul 3 2007, 22:58:17) [GCC 4.1.1 20070105 (Red Hat > 4.1.1-51)], > PIL 1.1.6 > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Build exe on Vista, have it run on XP?

2007-10-31 Thread Michael Langford
That's not really a working solution. My available development platform is a Vista machine. I don't have an available XP platform. XP built exes run fine on Vista, just not vice versa. --Michael On 10/31/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote: > &

[Tutor] Build exe on Vista, have it run on XP?

2007-10-29 Thread Michael Langford
mpile down to an exeis it a valid alternative? Should my CPython utility be compatible with ipy? I only use the random,time,sys, and serial modules. I really know nothing about ipy. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ __

Re: [Tutor] urllib2 and cookies

2007-10-25 Thread Michael Meier
is documented at http://docs.python.org/lib/module-cookielib.html Cheers, Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Michael Langford
n file('foo.dat'): tokens = line.split() dval = tokens[0] ls = [] for i in range(1,countOfVars+1): ls.append(float(tokens[i])) dic2[dval]=tuple(ls) print dic2 --Michael On 10/21/07, Bryan Fodness < [EMAIL PROTECTED]> wrote: > > Here is

Re: [Tutor] "standard output: Broken pipe"

2007-10-21 Thread Michael Langford
t *must* shutdown cleanly, signal handling is an essential item to put into your program. --Michael On 10/19/07, James <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a snippet of code in a Python script I'm whipping up that's > causing a not-so-pretty o

[Tutor] python help

2007-10-21 Thread Michael Langford
_ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/

Re: [Tutor] Decimal Conversion

2007-10-15 Thread Michael Langford
>Michael has already explained that this is building >a tuple of tuples. But you want to create strings. >So first convert r to a string using str(r) Yeah sorry about thatread some java over the weekend (source code to http://reprap.org)...and then munged some of its syntactic sugar

Re: [Tutor] Decimal Conversion

2007-10-15 Thread Michael Langford
comma operator. b+="," + r Was not doing exactly what I said. What it's doing is creating a new string from the one named by b, the string literal "," , and the one named by r. After creating the string it assigns the name b to the new string. --michael -- Michae

Re: [Tutor] Decimal Conversion

2007-10-15 Thread Michael Langford
Use b+=","+r instead. That will add the , to the string named by b, and will concatenate the string named by r to the end. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ On 10/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Re: [Tutor] slice lists and slicing syntax questions

2007-10-13 Thread Michael Langford
#x27;re going to be able to override the __getitem__ prototype without some serious pain.I've never tried to change the function/method signature with a decorator, but I'm pretty sure its possible at least for the non-builtin attributes. You may want to try to write a PEP for python 3000.

Re: [Tutor] VIX API

2007-10-11 Thread Michael Langford
if you're really feeling like you want to cause yourself some pain, you can try to hand code a python extension...but I suggest you try the automated tool first --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ On 10/11/07, Stephen

Re: [Tutor] internet access

2007-10-11 Thread Michael Langford
f you make some with SWIG: www.swig.org) --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ On 10/10/07, Kirk Vander Meulen <[EMAIL PROTECTED]> wrote: > > Hi, > I'd like to write a script that limits internet access to certain hour

Re: [Tutor] Increase speed

2007-10-09 Thread Michael Langford
You don't know what's slow. This is the perfect tool for a profiler. http://docs.python.org/lib/profile.html --Michael On 10/9/07, Øyvind <[EMAIL PROTECTED]> wrote: > > Hello. > > I have written a simple application that does a number of simple > calcu

Re: [Tutor] Top Programming Languages of 2013

2007-10-08 Thread Michael
I'd guess that by 2013 we'll be using a slightly more graceful, but still horribly wrong (and unsupported by IE 7.666), redo of HTML, CSS, Javascript, Flash, and Java with a poorly conceived back-end marriage of PHP + MySQL or some horrible Microsoft technology for most apps. I'll also venture that

Re: [Tutor] Really basic web templating

2007-10-01 Thread Michael Langford
Check to see if mod_python is installed/installable. It would quite easily give you a very simple interface to do what you're looking for. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ On 9/30/07, wormwood_3 <[EMAIL PROTECTED

Re: [Tutor] CGI File Woes

2007-09-30 Thread Michael Langford
t the error is rather than speculating about it. --Michael On 9/30/07, wormwood_3 <[EMAIL PROTECTED]> wrote: > Hello all, > > I am working on a very simple CGI script. The site I want to use it on is a > shared linux host, but I confirmed that .py files in the righ

Re: [Tutor] Learning Python

2007-09-29 Thread Michael Langford
errhttp://www.diveintopython.org is the actual url =Michael On 9/29/07, Michael Langford <[EMAIL PROTECTED]> wrote: > http://www.diveintopython.com is a *Great* start for experienced > software developers. Within a weekend with that book I'd written an > enti

Re: [Tutor] Learning Python

2007-09-29 Thread Michael Langford
http://www.diveintopython.com is a *Great* start for experienced software developers. Within a weekend with that book I'd written an entire parser/decompiler when I'd never used python before that. --michael On 9/29/07, Fred P <[EMAIL PROTECTED]> wrote: > Hey

[Tutor] Atomic file creation?

2007-09-28 Thread Michael Langford
ndows interpreter and visa versa." I'd check to see if the destination file exists before doing all of the above. I think your method is fine. Atomic file creation is not a common worry. I think this is a wholly reasonable quantity of code to pull it off. --Michael On 9/28/07

Re: [Tutor] [tutor]Help needed to read Ascii file in wxPython

2007-09-27 Thread Michael Langford
and running in a couple minutes. http://pythoncard.sourceforge.net/walkthrough1.html Run some of the example programs (they're in a subdirectory of your python folder, like the tutorial says). Their source code will lead you to an appropriate sort of file editor. --Michael -- Michael Lan

Re: [Tutor] do i have to import modules at the start of a file?

2007-09-27 Thread Michael Langford
ibrary that does all the common things. --Michael On 9/27/07, shawn bright <[EMAIL PROTECTED]> wrote: > It's the second one, not all the modules will be available on the portable > version. But the threads that require those modules will not be necessary on > the p

Re: [Tutor] New to Python and Linux

2007-09-25 Thread Michael Langford
ot;, then using the folder on the command line, browse to your python executable. I don't know where it is. If you open up a terminal and type: which python that *may* show you where it is. -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining

Re: [Tutor] Take if offline

2007-09-25 Thread Michael Langford
I agree with Kent... -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/25/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Hansen, Mike wrote: > > Anytime someone posts in HTML,

Re: [Tutor] python problem

2007-09-24 Thread Michael Langford
Look here. Do this: http://en.wikipedia.org/wiki/Binary_search -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/25/07, Chris <[EMAIL PROTECTED]> wrote: > > > > ***I have

[Tutor] Learning a Language

2007-09-23 Thread Michael Langford
e nice thing about going through the course work is that they're trying to teach programming, and just happen to be using python. That approach means you'll get the most important, general skills out of it. (That course or harder ones is required for all undergrads at that institution, so

Re: [Tutor] Capturing ctrl-c

2007-09-22 Thread Michael Langford
pass def graceful_cleanup() pass if "__main__" == __name__: try: do_stuff() except: graceful_cleanup() --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ En

Re: [Tutor] Quick question

2007-09-21 Thread Michael Langford
Use the .get method of the dict to return a nonzero value (say None or -1) when it can't find an item. That will half your test cases. Example of .get below: --Michael >>> foo = {} >>> foo['d']=0 >>> foo['a']=1 >>> if(foo.ge

Re: [Tutor] Threading in Python

2007-09-19 Thread Michael Langford
again, you don't have a shared memory space, so get used to using pickle if you don't have another text protocol to send data back and forth. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorS

Re: [Tutor] IndexError: list index out of range

2007-09-19 Thread Michael Langford
You should check if the stack is empty before you access it: def popNum(num): if len(stackA) > 0 and num == stackA[-1]: stackA.pop() #etc --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: h

Re: [Tutor] Income calculator

2007-09-19 Thread Michael Langford
.. Unless there is some really good reason you need text keys, this is a lot more natural. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to take in 2 or more values from user on a single line (like parameters?)

2007-09-19 Thread Michael Langford
gt;>> print a Bubby June >>> See how the variable "a" now has the whole sentence "Bubby June" in it? You can call split on "a" now and you'll get a list of words: >>> Names = a.split() >>> print Names ['Bubby','June

Re: [Tutor] Finding even and odd numbers

2007-09-19 Thread Michael Langford
least not one you'd like to see. You're going to confusing everyone if you implement isDivBy8 with bitwise operations. --Michael On 9/19/07, Terry Carroll <[EMAIL PROTECTED]> wrote: > > On Wed, 19 Sep 2007, Boykie Mackay wrote: > > > if not n&1: >

Re: [Tutor] Finding prime numbers

2007-09-19 Thread Michael Langford
Attachments are a bad thing to send to open mailing lists in general. In your case, the list appears to have filtered off the code. Please paste it in inline. --Michael On 9/19/07, Boykie Mackay <[EMAIL PROTECTED]> wrote: > > Hi Guys, > > Could you please look over

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-19 Thread Michael Langford
won't have the whole picture either. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/19/07, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > > Michael Langford wrote:

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-19 Thread Michael Langford
ut the bathroom sink and a bidet too). --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/19/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Ric

Re: [Tutor] sales tax

2007-09-18 Thread Michael Langford
.sourceforge.net/ is a project that implements it. I don't seem to see fixed point numbers in the python standard libraries, but then again, I'd not be surprised if they were there. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOne

Re: [Tutor] sales tax

2007-09-18 Thread Michael Langford
This function can easily found using the google programming rule: I want a function that does 'action' Type: into google Look in top 5 results. If that doesn't work, try synonyms for 'action' --Michael PS: The function you're looking for is called round.

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-18 Thread Michael Langford
classes. C++ has large issues for historical reasons on this front, as the implementation section of a class is largely revealed through the class definition. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirector

Re: [Tutor] Finding all the letters in a string?

2007-09-17 Thread Michael Langford
amp;^TUHKLJDHFKJHS(*&987") Which would produce: afdlkjaljrokjlkjTUHKLJDHFKJHS --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/17/07, Michael Langford <[EMAIL PROTECTED]> wrote: > > The

Re: [Tutor] Finding all the letters in a string?

2007-09-17 Thread Michael Langford
Not my night...the second sentence "To get the set of letters, use" should read "To get the filtered string".time for more Coke Zero. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com

Re: [Tutor] Finding all the letters in a string?

2007-09-17 Thread Michael Langford
At first I totally misread this To get the set of letters, use import string string.ascii_letters Then do what you said in your algorithm. A shorthand way to do that is filteredString = ''.join([c for c in foo if c in string.ascii_letters]) -- Michael Langford Phone: 40

Re: [Tutor] When to use a class

2007-09-17 Thread Michael Langford
apps. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/17/07, Eric Lake <[EMAIL PROTECTED]> wrote: > > I am still trying to understand when to use a class and when not

<    1   2   3   4   5   6   7   8   9   >