Re: [Tutor] Let imported module access calling program

2008-03-25 Thread Shrutarshi Basu
Wow...I never expected to get so much help. Thanks for all of it...it's much appreciated. I'm not quite sure which approach I'm going to use (have quite some thinking to do), but I'll certainly consider all of them. And I've certainly learned a lot. Thanks again, Basu -- The ByteBaker : http://w

Re: [Tutor] Maybe advanced pexpect question?

2008-03-25 Thread Nathan McBride
I'm thinking more along the lines as of running a program, sending tab to get to the field send text to put on the field, tab, send text ? On Sun, 2008-03-23 at 14:00 -0500, mwalsh wrote: > Kent Johnson wrote: > > Nathan McBride wrote: > >> I've used pexpect for a few projects and love it. Basica

Re: [Tutor] Let imported module access calling program

2008-03-25 Thread Michael Langford
The following is a pretty normal control loop for robot control (or other embedded devices). There are probably some syntactical errors as I'm writing this without a working python interpreter available at this second, but it should give you the correct gist to do what you said you were trying to d

[Tutor] Google Summer of Code 2008 - Student looking for Python Zope ZODB Grok Project / Mentor

2008-03-25 Thread Mali Ozbay
Hi there: I would love to see if there is anyone looking for a student to mentor to do some hacking in fields such as Python Zope ZODB Grok etc., during this summer, in the Google Summer of Code 2008. If you are interested in learning more about my background and experiences please see my resum

Re: [Tutor] struct.calcsize curiosity...

2008-03-25 Thread Greg Graham
Lawrence Wang wrote: > >>> struct.calcsize('hq') > 12 > >>> struct.calcsize('qh') > 10 > > why is this? is it platform-dependent? i'm on mac os x. This has to do with data alignment and is platform-dependent. Are you on a PowerPC Macintosh? On my Intel Windows XP box, I get the following: In [3]:

[Tutor] struct.calcsize curiosity...

2008-03-25 Thread Lawrence Wang
>>> struct.calcsize('hq') 12 >>> struct.calcsize('qh') 10 why is this? is it platform-dependent? i'm on mac os x. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help with input/output

2008-03-25 Thread Kent Johnson
Olexander wrote: > Hello, > > please could you help me with input processing for olympiad problems. Do you know how to read and write files? This is covered in every Python book and tutorial. What have you tried? What problems are you having? > I also wonder how to output several integers in o

Re: [Tutor] Problem with logic while extracting data from binary file

2008-03-25 Thread bob gailer
Bryan Fodness wrote: Here is my program.  Thank you for asking. I for one don't have the time or energy to go through this program in detail. It would be very helpful if you were to define a few things more clearly. You probably think you have done this but I don't get it. What is a sequ

Re: [Tutor] decimal precision

2008-03-25 Thread bob gailer
elis aeris wrote: [snip] I echo Dick Moore. Several of us have requested that you study the tutorials. We continue to see no evidence that you are doing that, nor have you told us you are reading them or why not. Please respond by telling us you are reading the tutorials or if not why not. If

[Tutor] Help with input/output

2008-03-25 Thread Olexander
Hello, please could you help me with input processing for olympiad problems. For example, what would be the code for input and output of this problem: Input The input file contains several test cases. The first line of each test case contains two integers A and D separated by a single space ind

[Tutor] Problem with logic while extracting data from binary file

2008-03-25 Thread Bryan Fodness
Here is my program. I am trying to extract values from a binary file for use in a calculation. I am having trouble with the logic. Everything goes well until I use the parseSequence function. If there is only one sequence I seem fine, but if there is a sequence within a sequence everything seem

Re: [Tutor] Python to C++

2008-03-25 Thread Andreas Kostyrka
Check out Cython or Pyrex. For a number of applications (performance speedup, C interfacing) they provide a quite Pythonic experience. Andreas Am Dienstag, den 25.03.2008, 07:21 -0700 schrieb Tony Cappellini: > Yes, but then you loose the clean Python readability, which is one of > the strong poi

Re: [Tutor] decimal precision

2008-03-25 Thread Dick Moores
Elis, You could have found the solutions to your various puzzlements by reading in Alan's tutorial, < http://www.freenetpages.co.uk/hp/alan.gauld/> The page reached by the "Simple Sequences" link probably is all you need.  Why don't you use these extremely useful sources of help? Dick Moores At

Re: [Tutor] Python to C++

2008-03-25 Thread Tony Cappellini
Yes, but then you loose the clean Python readability, which is one of the strong points for using Python On Tue, Mar 25, 2008 at 2:46 AM, Andreas Kostyrka <[EMAIL PROTECTED]> wrote: > Well, not exactly. Mixing Python with C/C++ extends the "coverage" that > you can do with Python. > > Andreas >

Re: [Tutor] decimal precision

2008-03-25 Thread Michael Connors
On 25/03/2008, elis aeris <[EMAIL PROTECTED]> wrote: > > what if i want it only to 2nd decimal? > > what if i want to cut off everything behind decimal? > In: print "%.2f" % (0.99) Out: 0.99 http://docs.python.org/lib/typesseq-strings.html -- Michael Connors

Re: [Tutor] decimal precision

2008-03-25 Thread elis aeris
what if i want it only to 2nd decimal? what if i want to cut off everything behind decimal? On Tue, Mar 25, 2008 at 6:30 AM, Michael Connors <[EMAIL PROTECTED]> wrote: > > On 25/03/2008, elis aeris <[EMAIL PROTECTED]> wrote: > > > x = 53 > > w = 192 > > for a in range ( x, (x+192) ): > > pri

Re: [Tutor] decimal precision

2008-03-25 Thread Michael Connors
On 25/03/2008, elis aeris <[EMAIL PROTECTED]> wrote: > > x = 53 > w = 192 > for a in range ( x, (x+192) ): > print (a-x)/w > > > the problem is at (a-x)/w > > it's supposed to return a ratio between x and w, yet it 0 all the time. > > ___ > Tutor mail

Re: [Tutor] decimal precision

2008-03-25 Thread Michael Connors
On 25/03/2008, elis aeris <[EMAIL PROTECTED]> wrote: > > x = 53 > w = 192 > for a in range ( x, (x+192) ): > print (a-x)/w > > > the problem is at (a-x)/w > > it's supposed to return a ratio between x and w, yet it 0 all the time. > > ___ > Tutor mail

[Tutor] decimal precision

2008-03-25 Thread elis aeris
x = 53 w = 192 for a in range ( x, (x+192) ): print (a-x)/w the problem is at (a-x)/w it's supposed to return a ratio between x and w, yet it 0 all the time. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Let imported module access calling program

2008-03-25 Thread Kent Johnson
Shrutarshi Basu wrote: > The event handling approach looks interesting and isn't something that > I haven't encountered before. Could you to point me somewhere I could > learn more about it? Not really...this is commonly used by GUI frameworks. For example in Tkinter you can register a mouse-butt

Re: [Tutor] Let imported module access calling program

2008-03-25 Thread Shrutarshi Basu
The event handling approach looks interesting and isn't something that I haven't encountered before. Could you to point me somewhere I could learn more about it? I've already read the papers published by the Pyro group and looked at some of their sample programs. I am trying to give the user a simi

Re: [Tutor] Python to C++

2008-03-25 Thread elis aeris
i personally write my python code with c++ in mind because i knew i am going to rewrite it over. so it's very easy to do that. it's fun to find out how many more lines of c++ is required for something done with 2 lines in python. On Tue, Mar 25, 2008 at 2:46 AM, Andreas Kostyrka <[EMAIL PROTECTED

Re: [Tutor] Let imported module access calling program

2008-03-25 Thread Kent Johnson
Shrutarshi Basu wrote: >> This seems kind of strange to me. You want the entire user module to be >> re-run? > > Well perhaps not the entire module, but probably most of it. How will you know how much to re-run? Reloading a module re-runs *all* of it, including reinitializing any global variab

[Tutor] New Kent's Korner: urllib2 cookbook

2008-03-25 Thread Kent Johnson
Draft notes for the next Kent's Korner presentation are available at http://personalpages.tds.net/~kent37/kk/00010.html Comments welcome. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python to C++

2008-03-25 Thread Andreas Kostyrka
Well, not exactly. Mixing Python with C/C++ extends the "coverage" that you can do with Python. Andreas Am Montag, den 24.03.2008, 23:39 -0700 schrieb Tony Cappellini: > Another alternative is Weave > http://www.scipy.org/Weave > > But mixing C/C++ with Python sort of defeats the reasons for us