Re: [Tutor] Tutor Digest, Vol 106, Issue 5

2012-12-03 Thread Luke Paireepinart
I apologize for the blank message I just sent, the "send" button is near the "..." button. > >> Okay, this is where I stopped reading. >> >> You should pay attention to the emails that other people are sending. >> Notice how they reply to individual emails, not to a mass digest? Then >> pay attent

Re: [Tutor] Tutor Digest, Vol 106, Issue 5

2012-12-03 Thread Luke Paireepinart
On Mon, Dec 3, 2012 at 9:24 AM, Steven D'Aprano wrote: > On 04/12/12 00:55, Spectral None wrote: > >> From:"tutor-requ...@python.org**" >> To:tutor@python.org >> Sent: Sunday, 2 December 2012, 17:34 >> Subject: Tutor Digest, Vol 106, Issue 5 >> >> Send Tutor mailing list submissions to >>

Re: [Tutor] Help with writing a program

2012-12-02 Thread Luke Paireepinart
There is an equivalent page in the documentation for Python 3 as well, regarding strings. This sounds a lot like a homework problem so you are unlikely to get a lot of help. You certainly won't get exact code. What have you tried so far? Where are you getting stuck? We're not here to write cod

Re: [Tutor] FW: (no subject)

2012-12-02 Thread Luke Paireepinart
On Sun, Dec 2, 2012 at 8:41 PM, Ashfaq wrote: > Luke, > > Thanks. The generator syntax is really cool. > I misspoke, the correct term is "list comprehension". A generator is something totally different! Sorry about the confusion, my fault. I type too fast sometimes :) Glad you liked it though

Re: [Tutor] FW: (no subject)

2012-12-01 Thread Luke Paireepinart
Ashfaq, On Sat, Dec 1, 2012 at 10:46 AM, Ashfaq wrote: > Run your code 10,000 times. :) > > > ** ** >> >> import math >> >> import random >> >> random.seed() >> >> > there is no need to call seed() with no parameters. From the docs: """ If *x* is omitted or None, current system tim

Re: [Tutor] How have I transgressed??

2011-08-21 Thread Luke Paireepinart
Same here as Andre said. I've gotten that email probably a dozen times by now. It's based on an amount of absence I believe. - Sent from a mobile device. Apologies for brevity and top-posting. - On Aug 21, 2011, at 2:37 PM, Andre Engels wr

Re: [Tutor] Python GUI

2011-06-28 Thread Luke Paireepinart
The error message tells you everything... On line 60, you try to add to "number" but the variable hasn't been defined. We aren't going to debug your code for you, do YOU think it will work apart from this? Have you tried running any of the code? It's almost always better to build small parts an

Re: [Tutor] Type error: must be string or read-only character buffer, not seq

2011-04-19 Thread Luke Paireepinart
It's saying one of your variables is not a string. Is one of them a sequence? Perhaps Mir-seq? If so, you need to come up with a way to build a string from this object. You can call the str method and pass in your object or you can explicitly create a string from the data in the object. ---

Re: [Tutor] Python on TV

2011-04-14 Thread Luke Paireepinart
I don't see how a content provider preventing you from accessing content internationally that they probably don't have international distribution rights to as censorship. It's not like your ISP is blocking your access. - Sent from a mobile device. Apologies for brevit

Re: [Tutor] List sorting issues

2011-03-28 Thread Luke Paireepinart
Sort returns none because it changes your list in-place. Print your list out after calling sort and you should see the new one. - Sent from a mobile device. Apologies for brevity and top-posting. - On Mar 28, 2011, at 11:53 AM, Eric Stevens

Re: [Tutor] Facebook

2011-01-27 Thread Luke Paireepinart
And what have you tried? What libs are you using? Which part is confusing you? - Sent from a mobile device. Apologies for brevity and top-posting. - On Jan 27, 2011, at 9:08 AM, Christopher King wrote: > Dear Tutors, > I'm using the Fa

Re: [Tutor] Why super does not work !

2011-01-17 Thread Luke Paireepinart
I think it might be related to your multiple inheritance, maybe super is calling the init of observable on the listbox portion or something? I hardly ever do multiple inheritance so I'm not sure. What happens if you swap observable to be the first one? - Sent from a

Re: [Tutor] (no subject)

2011-01-13 Thread Luke Paireepinart
On Thu, Jan 13, 2011 at 4:53 PM, Steven D'Aprano wrote: > lmho...@jacks.sdstate.edu wrote: >> >> Hello All, >> I am having an issue with lists and am not sure where to go from here any >> advice appreciated. I colored the areas of concern. >> blue my comments >> purple example of output >> red are

Re: [Tutor] Beginning Python and other resources (was Re: SlicingTuples)

2011-01-13 Thread Luke Paireepinart
Also check bigwords.com, they aggregate lots of other book sites and will get you a great deal, especially if you are buying multiple books because it smartly combines shipping and all. - Sent from a mobile device. Apologies for brevity and top-posting. --

Re: [Tutor] Sorting a List

2011-01-12 Thread Luke Paireepinart
Remember the sorted() method takes a key function, have this key function take in each filename and compare the numbers and you're all set! - Sent from a mobile device. Apologies for brevity and top-posting. - On Jan 12, 2011, at 8:17 PM, B

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Luke Paireepinart
No. Did you try that? It doesn't evn look like valid python code to me. You want a single string with the r before it, not 3 separate strings. - Sent from a mobile device. Apologies for brevity and top-posting. - On Jan 12, 2011, at 8:02 AM,

Re: [Tutor] python hyperlinks question

2011-01-12 Thread Luke Paireepinart
Not really a python question, but maybe look at that pyexcel or whatever. Should be able to add links to it that way. Csv is jus a data interchange format though, if excel supports passing links thru it then you can do it, otherwise don't use csv for this. - Sent fro

Re: [Tutor] test- why no traffic?

2011-01-11 Thread Luke Paireepinart
i see you. did you change your settings so you don't get e-mails? On Tue, Jan 11, 2011 at 12:17 PM, wrote: > hmmm, wonder if my membership went belly up... no traffic arriving... > hmmm... > > ___ > Tutor maillist  -  tu...@python.org > To unsubscribe

Re: [Tutor] REGEX EXPLANATION

2010-12-21 Thread Luke Paireepinart
Which part of the regexes do you not understand? Have you tried figuring themselves out yourself first? We don't typically give out answers here. This is a tutor list, not a solve your problems for you list. We're here to teach you how to fish, not cook for you. So show us where you're stuck and

Re: [Tutor] Trying to parse a HUGE(1gb) xml file in python

2010-12-21 Thread Luke Paireepinart
You're not going to win any friends here Dave. Steven is well known on this list. He is sometimes abrasive but it's rarely if ever malicious. Anytime he's ever been rude to me it was deserved. Like how I top post from my phone. Or giving bad advice to newbies. People are getting irritated becau

Re: [Tutor] AttributeError: 'list' object has no attribute 'find'

2010-12-21 Thread Luke Paireepinart
Read() does return a string. I guess the better question would be... Are you using read? 'cause in the example you sent you used readlines() which returns a list of lines. - Sent from a mobile device with a bad e-mail client. - On Dec 21,

Re: [Tutor] Trying to parse a HUGE(1gb) xml file in python

2010-12-20 Thread Luke Paireepinart
If you can assume a well formatted file I would just parse it linearly, should be much faster. Read the file in as lines if the XML is already in human readable form, or just read in blocks and append to a list and do a join() when you have a whole match. - Sent from

Re: [Tutor] Help with using the ctypes module

2010-12-13 Thread Luke Paireepinart
I confess I don't know a lot about C so I may be off base here... But it looks like your c func extendarray returns a pointer to the new extended array, but you are not capturing this pointer in your python when you call the c func. So the python code is pointing at the old deallocated array.

Re: [Tutor] Question about the "main" Python help list

2010-12-04 Thread Luke Paireepinart
Next time you email tutor, start a new email msg instead of clearing out the contents of a reply to a different e-mail. When you do it like that it breaks threading, so all these emails are in the same thread as the "need help" one even though they aren't related to that e-mail. ---

Re: [Tutor] permutations?

2010-12-02 Thread Luke Paireepinart
Instead of nested fors which will grow exponentially in running time, consider this for removing reversals: newlist = [] tempdict = {} for i in oldlist: try: tempdict[i] except: tempdict[i] = 1 tempdict[i.reverse()] = 1 newlist.append(i) That's the gneral

Re: [Tutor] Is Python useful for emulating?

2010-11-28 Thread Luke Paireepinart
It probably won't be fast enough. I wrote an NES emu in python and I ran into a lot of performance issues. If you're new to emu scene, start with David winters' doc and write a chip-8 emu. I will help you learn the structure and process of writing an emulator. Then reimplememt it in c afterward

Re: [Tutor] variables question.

2010-11-10 Thread Luke Paireepinart
It's pretty typical for scoping rules. If you define variables outside of your funcs you can access them inside the func. If you want to change the value in the function you need to declare the scope as global. If you make another variable with the same name inside of a function it will shadow t

Re: [Tutor] Server

2010-11-08 Thread Luke Paireepinart
On Mon, Nov 8, 2010 at 3:53 PM, Chris King wrote: >  On 11/5/2010 8:10 PM, Alan Gauld wrote: >> >> "Chris King" wrote >> If you are using Windows, turn off the built-in firewall. That's what fixed my problems. ~Corey >> >>> also, it is on the same network, so the server shouldn't b

Re: [Tutor] Columnar Transposition Cipher question

2010-11-08 Thread Luke Paireepinart
On Mon, Nov 8, 2010 at 5:28 PM, Natalie Kristine T. Castillo wrote: > Hi, I need help on how exactly to solve this: That's nice. > > To send secret messages you and your partner have decided to use the > columnar function you have written to perform columnar transposition cipher > for this course

Re: [Tutor] Commercial or Famous Applicattions.?

2010-11-08 Thread Luke Paireepinart
just off the top of my head... NASA uses it. Lots of games use Python as their game logic/scripting language (how many use PHP? probably approaching 0. LUA is more popular than Python but Python is much more popular than PHP). The first ever bittorrent client (the official one) was written in P

Re: [Tutor] test

2010-11-05 Thread Luke Paireepinart
You don't get your own e-mails back. On Fri, Nov 5, 2010 at 11:37 PM, Danyelle Davis wrote: > im wondering if im able to mail this list.  I sent an email asking for good > newbie projects but never saw it post.  All i got was the welcome/ info > email. > LN > _

Re: [Tutor] Looking for a tutor to review my code and provide constructive feedback.

2010-11-04 Thread Luke Paireepinart
Your code is not bad overall, pretty great for a beginner actually. I would say you should read guido's style guide though; some of your variable and function naming is nonstandard python. - Sent from a mobile device with a bad e-mail client. -

Re: [Tutor] Looking for a tutor to review my code and provide constructive feedback.

2010-11-04 Thread Luke Paireepinart
Also for your confirm entries read about sentinel values for while loops. It saves you repeating the conditional in the loop body. And you might want to .lower().strip()[0] the input choice so that they can use y, Y, yes, or whatever. Remember, users suck at generating accurate and correct input

Re: [Tutor] Looking for a tutor to review my code and provide constructive feedback.

2010-11-04 Thread Luke Paireepinart
Also for your confirm entries function, read about while loops - Sent from a mobile device with a bad e-mail client. - On Nov 4, 2010, at 3:10 PM, Glen Clark wrote: > Hello, > > I have completed my first python script. This is after watc

Re: [Tutor] (no subject)

2010-10-28 Thread Luke Paireepinart
On Thu, Oct 28, 2010 at 8:11 PM, Steven D'Aprano wrote: > >> postPos=words[3] > > This like will fail with NameError, because words is not defined anywhere. > > This is not the code you are running. We can't tell what is wrong with the > code you run when you show us something completely different

Re: [Tutor] (no subject)

2010-10-28 Thread Luke Paireepinart
This code shouldn't even actually execute, you should get an indexerror exception. Close your IDE and try it again. Should make the issue more clear. - Sent from a mobile device with a bad e-mail client. - On Oct 27, 2010, at 1:04 PM, "Terr

Re: [Tutor] functions: use return or exceptions?

2010-09-23 Thread Luke Paireepinart
You should do both. Raise an exception in the exceptional case. My general pattern is to return None if no results exist, return the results if they do exist, and raise an exception if I couldn't perform the function. Eg. If I have a function that creates a list of users with a first name of bob

Re: [Tutor] py-postgressql v1.0.1 question

2010-09-12 Thread Luke Paireepinart
> > Thanks for the tip. I'll do some more research but this sounds promising. > > Rance > Just be aware that some methods of list building will iterate over the list and evaluate it. So if you only want to retrieve the first 10 results but you do something like Results = [I.fetch() for I in c

Re: [Tutor] forcing hashlib to has string variables

2010-09-12 Thread Luke Paireepinart
e b back into the mix, I get a hash with no error messages. > > But I still can't quite figure out how to get the variable contents > into the hashing function. > > On Sun, Sep 12, 2010 at 1:47 PM, Luke Paireepinart > wrote: >> This is how I use it (untested) >>

Re: [Tutor] forcing hashlib to has string variables

2010-09-12 Thread Luke Paireepinart
This is how I use it (untested) Import hashlib Print hashlib.md5("somestr").hexdigest() Works fine without using binary string. On Sep 12, 2010, at 1:19 PM, Rance Hall wrote: > Everybody knows you don't store plain text passwords in a database, > you store hashes instead > > consider: > > us

Re: [Tutor] recursive problem

2010-09-11 Thread Luke Paireepinart
On Sep 11, 2010, at 12:40 PM, Roelof Wobben wrote: > > > > >> From: st...@pearwood.info >> To: tutor@python.org >> Date: Sun, 12 Sep 2010 03:27:42 +1000 >> Subject: Re: [Tutor] recursive problem >> >> On Sun, 12 Sep 2010 03:18:19 am Steven D'Aprano wr

Re: [Tutor] exceptions problem

2010-09-10 Thread Luke Paireepinart
Roleof, do you think you could stop sending HTML messages and use plaintext instead? I usually skip over your posts because your font is so small and hard to read that I don't even bother. If you send plain-text messages (which is the norm on programming mailing lists) then you leave it up to the

Re: [Tutor] changing list index start

2010-09-10 Thread Luke Paireepinart
Yeah, just add 1 to it. When printing just do index+1 and when inputting the user's choice, subtract 1 and use it as the array index. Sent from my iPhone On Sep 10, 2010, at 4:36 PM, Rance Hall wrote: > I'm using the following function style I found on the net to create > menus for a command

Re: [Tutor] hashlib problems

2010-09-10 Thread Luke Paireepinart
In general, you shouldn't even hint at the possibility of there being a bug in the code unless you have test cases and a patch handy. Especially something as widely used as hashlib. It gives An air of arrogance about your post, whether you intend it or not. I think your issue got resolved alrea

Re: [Tutor] recursive problem

2010-09-09 Thread Luke Paireepinart
n Fri, 10 Sep 2010 01:05:22 am Joel Goldstick wrote: > > On Thu, Sep 9, 2010 at 10:26 AM, Luke Paireepinart > > > > wrote: > > > Shouldn't there be a way to do this without type checking? Duck > > > typing! > > > > > > Your post got me thi

Re: [Tutor] recursive problem

2010-09-09 Thread Luke Paireepinart
Shouldn't there be a way to do this without type checking? Duck typing! Sent from my iPhone On Sep 9, 2010, at 7:33 AM, Joel Goldstick wrote: > > > On Thu, Sep 9, 2010 at 7:59 AM, Shashwat Anand > wrote: > > > On Thu, Sep 9, 2010 at 3:11 PM, Roelof Wobben wrote: > > > From: anand.shas

Re: [Tutor] Adding to a CSV file?

2010-08-30 Thread Luke Paireepinart
On Mon, Aug 30, 2010 at 12:04 PM, wrote: > I checked out the csv module and got a little further along, but still can't > quite figure out how to iterate line by line properly. >  > # But when I try to add columns, I'm only filling in some static value. So > there's something wrong with my loopin

Re: [Tutor] Moving from Python 2.5.4 to 2.5.2?

2010-08-16 Thread Luke Paireepinart
2010 at 3:57 PM, Wayne Watson wrote: > The question is would going back likely cause problems? I'm dealing with > neophytes. He's messed up before. > > On 8/16/2010 8:58 AM, Luke Paireepinart wrote: >> >> On Mon, Aug 16, 2010 at 10:39 AM, Wayne Watson >>  

Re: [Tutor] Moving from Python 2.5.4 to 2.5.2?

2010-08-16 Thread Luke Paireepinart
On Mon, Aug 16, 2010 at 10:39 AM, Wayne Watson wrote: > My partner got ahead of the game last year, and installed 2.5.4, which > confounds matters when the other four participants when sharing some python > programs under Win XP. My guess is that if he uses control panel add/remove > for py 2.5.4,

Re: [Tutor] my Python learning exercise

2010-08-16 Thread Luke Paireepinart
On Sat, Aug 14, 2010 at 6:17 PM, Bill Allen wrote: > In the process of learning Python, I have given myself a programming > exercise to do.  This is a standard thing I do whenever learning a new > programming language and I have used this same exercise several times before > with other programming

Re: [Tutor] problem loading and array from an external file

2010-08-11 Thread Luke Paireepinart
Don't pass none. It's an optional parameter. It's accepted practice to not pass optional parameters. Sent from my iPhone On Aug 11, 2010, at 6:46 PM, Bill Allen wrote: > On Tue, Aug 10, 2010 at 11:11 AM, Hugo Arts wrote: >> On Tue, Aug 10, 2010 at 9:59 AM, bob gailer wrote: >>> On 8/10/2010

Re: [Tutor] Question about strings

2010-08-09 Thread Luke Paireepinart
Hey email in plain text in the future, HTML is not kind to mobile screens and in general you should plaintext reply to tech lists. All list indices start from 0. But you don't get the last value. So slice[1:5] would skip the first char and then include the next 3. It's the same as range. Range(

Re: [Tutor] Fwd: Need mentor

2010-08-09 Thread Luke Paireepinart
On Mon, Aug 9, 2010 at 1:32 AM, Ranjith Kumar wrote: > Hi all, > > I have described the theme of my project here, > Cheers > Ranjith, > This sounds kind of like homework. Is it homework? If not, where did you get this spec from? Thanks, -Luke ___ Tutor

Re: [Tutor] Menu not working properly

2010-08-02 Thread Luke Paireepinart
On Aug 2, 2010, at 8:13 AM, David Hutto wrote: > On Mon, Aug 2, 2010 at 8:00 AM, Evert Rol wrote: >>> Hello Evert Rol, >>> Thank you for the menu help, I have completed it with great >>> success... There is 1 more problem I am currently having, and when I fix it >>> my program will

Re: [Tutor] Simple Python Program

2010-07-31 Thread Luke Paireepinart
I think I agree more with bob on this one - he wasn't saying functions weren't important, just that they weren't important to this case. Sure polymorphism and inheritance and properties and generators and list comprehensions are awesome and useful, but I wouldn't suggest they are necessary for e

Re: [Tutor] Making a sound

2010-07-31 Thread Luke Paireepinart
You can generate the sound data in a buffer either in native python or using numpy, then play it back by loading the buffer into a sound object with pygame. It depends how much control you want on the sounds. You might want to use csound or supercollider or something if you want to programmatica

Re: [Tutor] problem with simple script

2010-07-28 Thread Luke Paireepinart
Just do a split of the input from the user on space or comma. If Len() of the split data is 1, do your [1, ...] interval, otherwise do the other interval. Sent from my iPhone On Jul 28, 2010, at 6:51 AM, "Richard D. Moores" wrote: > I have a practical need for a script that will give me a rand

Re: [Tutor] position of an element in list:

2010-07-23 Thread Luke Paireepinart
You can do it with any iterator Astr.index('o') I'm not sure what happens when there are multiple instances of 'o' though, check the docs on index. Sent from my iPhone On Jul 23, 2010, at 8:22 AM, Vineeth Rakesh wrote: > Hello all, > > How to return the position of a character in a strin

Re: [Tutor] how i can change two lists into one directory

2010-07-22 Thread Luke Paireepinart
Hey quit spamming the list please. Sent from my iPhone On Jul 22, 2010, at 7:08 PM, Alex Hall wrote: > On 7/22/10, ANKUR AGGARWAL wrote: >> hey i have just started making a app using python and just gt a problem.. >> >> i have two list >> a=["x","z"] >> b=[1,2] >> >> i want to make a direct

Re: [Tutor] sound libraries?

2010-07-22 Thread Luke Paireepinart
You can access openal through either pyglet or pygame I believe, and definitely thru panda3d. That would allow you to have true 3d sound positioning and I believe openal can automatically Doppler too, not sure though. Let us know what you go with or if you have questions. Sent from my iPhone O

Re: [Tutor] has it gone quiet or is it just me?

2010-07-21 Thread Luke Paireepinart
Not sure Alan. I haven't gotten any messages either, but this one came through just fine. -Luke On Wed, Jul 21, 2010 at 12:55 PM, Alan Gauld wrote: > I haven't had any tutor messages in 2 days. > Do I have a problem or are things just very quiet suddenly? > The archive isn't showing anything eith

Re: [Tutor] searching for multiple strings in line.starswith()

2010-07-19 Thread Luke Paireepinart
You are using Line.startswith incorrectly, read the docs on it and see if you can figure out your problem an key us know. Pay attention to the parameters it takes and the values it returns. Sent from my iPhone On Jul 19, 2010, at 11:18 AM, Bala subramanian wrote: > Friends, > I have to extra

Re: [Tutor] A file containing a string of 1 billion random digits.

2010-07-17 Thread Luke Paireepinart
On Jul 17, 2010, at 7:19 PM, "Richard D. Moores" wrote: > I don't fully understand your "you always have two [chunks] in memory > at once". Does that take care of the overlap I think I need? I don't > want you or anyone to give me the the whole answer, but could you > clarify a bit about keeping

Re: [Tutor] now = ctime()[11:20]

2010-07-17 Thread Luke Paireepinart
Sorry the iPhone email client is terrible. It sent the previous email before I was done writing it. Anyway, the timeit module is available whenever you want to profile something and determine how long it takes to run. Sent from my iPhone On Jul 17, 2010, at 1:32 AM, "Richard D. Moores" wrote:

Re: [Tutor] now = ctime()[11:20]

2010-07-17 Thread Luke Paireepinart
If you are asking how to get a variable to call a function each time it's accessed... Well that's kind of a weird request. I know you can create properties in a class that act like variables but you can do whatever you want behind the scenes, like calling the now() function on each access. A muc

Re: [Tutor] Searching a text file's contents and comparing them toa list

2010-07-14 Thread Luke Paireepinart
You already know how to store multiple vars -- use lists! Just create a blank one before your loop and append() to it. Also you might think of a generic way to do this without relying on separate variables for each aisle, what if your store has 30 aisles? Hint: lists can contain any python objec

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Luke Paireepinart
On Jul 11, 2010, at 11:14 AM, Nick Raptis wrote: >> >> >> > > Also, another preference of mine, would you be kind enough to answer to the > list and cc the original poster if you can? Doing it the other way around > breaks my (quite stupid I admit) filters, and perhaps others' too. That's t

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Luke Paireepinart
I think the new version is harder to understand. Sent from my iPhone On Jul 11, 2010, at 10:43 AM, Nick Raptis wrote: > On 07/11/2010 06:28 PM, Nick Raptis wrote: >> >> def recursfac(x,carryover=1): >>print 'x:',x,'carryover:', carryover >>if x > 1: >>carryover *= x >>c

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Luke Paireepinart
On Fri, Jun 25, 2010 at 8:43 PM, David Hutto wrote: > On Fri, Jun 25, 2010 at 9:37 PM, Randy Kao wrote: >> Thanks for the great and quick feedback from everyone! >> That definitely clears things up. >> -Randy > > And I was like...me too. Just to clarify, it looks like subprocess is intended to r

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Luke Paireepinart
On Fri, Jun 25, 2010 at 7:48 PM, David Hutto wrote: > On Fri, Jun 25, 2010 at 8:16 PM, Steven D'Aprano wrote: >> On Sat, 26 Jun 2010 08:46:17 am Randy Kao wrote: >>> Hi all, >>> >>> I'm a newbie to Python (switching from Perl) and had a question about >>> the best way to run external commands in

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Luke Paireepinart
Subprocess module is the preferred strategy when You want to communicate with the command you're running. If not, you can use os.system. Sent from my iPhone On Jun 25, 2010, at 5:46 PM, Randy Kao wrote: > Hi all, > > I'm a newbie to Python (switching from Perl) and had a question about the >

Re: [Tutor] Better construct? (was no subject)

2010-06-12 Thread Luke Paireepinart
> >> ## Can someone suggest a pythonesque way of doing this? >> >> >> def getid(): >>    response  = raw_input('prompt') >>    if response not in [ "", "y", "Y", "yes"] : >>        getid()    # ouch >>    print "continue working" >>    # do more stuff >>    # do more stuff >> This seems like really

Re: [Tutor] PYTHON ON NOKIA E71

2010-05-30 Thread Luke Paireepinart
On Sun, May 30, 2010 at 1:17 PM, Dipo Elegbede wrote: > Hi all, > Pls does anyone know whether I can install python and code on my Nokia E71? > I have full access to computer at my office but not at home. This is > creating a serious break in my flow of study. > With python on my phone,I can learn

Re: [Tutor] list of dicts <-> dict of lists?

2010-05-28 Thread Luke Paireepinart
> I'm new to python, so i don't know if this is important, or what it means at > all.  I looked in setup.py, and it didn't tell me anything.  What does it > mean by "the necessary bits" were not found? Not really sure, but in the future please create a new e-mail to tutor@python.org rather than

Re: [Tutor] Successfully trapping the [505 file not found] error

2010-05-26 Thread Luke Paireepinart
> > What follows is the exception handling snippet: > ## -- > except ftplib.error_perm, e: >    msg = "Couldn't get %s %s" % (fname,str(sys.exc_info()[1])) >        log.add(msg) >        more-code-follows > ##

[Tutor] Fwd: Learning python using Michael Dawson's book

2010-05-17 Thread Luke Paireepinart
Forwarding. Peter use reply-all don't reply offlist please. -- Forwarded message -- From: Peter Date: Mon, 17 May 2010 10:08:47 -0400 Subject: Re: [Tutor] Learning python using Michael Dawson's book To: Luke Paireepinart Hi, The result in the book has letterin

Re: [Tutor] Learning python using Michael Dawson's book

2010-05-17 Thread Luke Paireepinart
I don't see any printing of dashes whatsoever. can you explain in more detail what output you're getting, how it's different from what you expected, and why you think that happened? On 5/17/10, Peter wrote: > Hello, > I am at the very beginning of learning Python. If anyone is familiar > with Mic

Re: [Tutor] application with tabs

2010-05-14 Thread Luke Paireepinart
Thanks for that info, Alan! It's pretty awesome to have support for a gui that looks native and is also included with Python by default. I'll check it out soon. On 5/14/10, Alan Gauld wrote: > > "Luke Paireepinart" wrote > >> well, but tkinter looks kinda cr

Re: [Tutor] application with tabs

2010-05-14 Thread Luke Paireepinart
On Fri, May 14, 2010 at 12:55 PM, Gary Koskenmaki wrote: > Hi, > > I'm new to any kind of application development, but have done some > python scripting. > > What I'm doing is creating an application for a non-profit social > services organization that will allow them to track the services they >

Re: [Tutor] Design Question: File Object used everywhere

2010-05-13 Thread Luke Paireepinart
On Thu, May 13, 2010 at 11:49 PM, Jan Jansen wrote: > Hi there, > > I'm working on a code to read and write large amounts of binary data > according to a given specification. In the specification there are a lot of > "segments" defined. The segments in turn have defintions of datatypes and > what

Re: [Tutor] creating distribution lists in outlook

2010-05-12 Thread Luke Paireepinart
On Wed, May 12, 2010 at 6:32 PM, Pirritano, Matthew wrote: > Here's the thing. You can import them all at once. But then you have > 1000+ contacts in one contacts folder. When you create the distribution > lists a number get cut off if you try to put too many into the list. But > there is no indic

Re: [Tutor] creating distribution lists in outlook

2010-05-12 Thread Luke Paireepinart
On Wed, May 12, 2010 at 6:20 PM, Pirritano, Matthew wrote: > That's the way we've been doing it. The issue, and inspiration for > pythonification is that the list has 1000+ emails. Outlook only allows > about 50 per list, which leads to the need to create 20+ separate lists, > which takes a consid

Re: [Tutor] creating distribution lists in outlook

2010-05-12 Thread Luke Paireepinart
On Wed, May 12, 2010 at 12:44 PM, Pirritano, Matthew wrote: > Pythonistas, > > I’m trying to find a way to get data into outlook. Specifically to create > distribution lists. Have you considered looking into Outlook's Import feature for address books? It may be possible to import data from csv's

Re: [Tutor] raw_input a directory path

2010-05-12 Thread Luke Paireepinart
On Wed, May 12, 2010 at 2:44 PM, Spencer Parker wrote: > I have a search and replace script that I am having the user put in the > directory path as raw_input.  The problem lies when I run the script it > doesn't pick that up for some reason.  Is there an appropriate way to take a > directory path

Re: [Tutor] Find Elements in List That Equal A Specific Value

2010-05-12 Thread Luke Paireepinart
On Wed, May 12, 2010 at 1:22 PM, bob gailer wrote: > On 5/12/2010 1:58 PM, Su Chu wrote: >> >> I have three lists, one with unique values (list 1), one a sequence of >> values that are not necessarily unique (list2), and a shorter list with the >> unique values of list 2 (list 3). List 1 and List

Re: [Tutor] (no subject)

2010-05-12 Thread Luke Paireepinart
> > Siva is it possible that you accidentally installed the 64-bit version of > python 3.1? > Hi Luke > I checked again and found that Python Shell has the following which is win32 > > Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] > on win32 > Type "copyright", "cre

Re: [Tutor] (no subject)

2010-05-11 Thread Luke Paireepinart
I'm just not going to quote previous threads because with my top-posting and dave's bottom-posting and whatever the heck Siva's posting was... whatever. Read previous e-mails if you need context. Siva is it possible that you accidentally installed the 64-bit version of python 3.1? ___

Re: [Tutor] (no subject)

2010-05-11 Thread Luke Paireepinart
I'd have rather you top-posted, then I wouldn't have wasted 30 seconds scrolling past a bunch of irrelevant crap that I just gloss over anyway. If I want context I'll read the previous messages in the thread. but that's just MHO. -Luke On Tue, May 11, 2010 at 9:28 PM, Dave Angel wrote: > (1. Plea

Re: [Tutor] Help required to count no of lines that are until 1000 characters

2010-05-11 Thread Luke Paireepinart
On Tue, May 11, 2010 at 1:00 PM, ramya natarajan wrote: > Hello, I have to read lines from > files exactly upto 1000 characters. >But the problem is its reading entire line and not stopping > excatly in 1000 characters. Can some one help what mistake i am doing here?. > >    log = open('/tmp/new.t

Re: [Tutor] Iterating through a list of strings

2010-05-03 Thread Luke Paireepinart
2010/5/3 spir ☣ : > On Mon, 03 May 2010 10:55:11 +0200 > Stefan Behnel wrote: > >> Luke Paireepinart, 03.05.2010 10:27: >> > On Mon, May 3, 2010 at 1:49 AM, Stefan Behnel wrote: >> >>                 line = line.split('%', 1)[0] >>

Re: [Tutor] Iterating through a list of strings

2010-05-03 Thread Luke Paireepinart
On Mon, May 3, 2010 at 3:50 AM, Stefan Behnel wrote: > Luke Paireepinart, 03.05.2010 10:27: >> What's this bizarre syntax? > > Look it up in the docs, it's called "with statement". Its purpose here is to > make sure the file is closed after the execution of

Re: [Tutor] Iterating through a list of strings

2010-05-03 Thread Luke Paireepinart
On Mon, May 3, 2010 at 1:49 AM, Stefan Behnel wrote: > > You are modifying the list during iteration, so the size changes and the > iterator gets diverted. Don't remove the line, just skip over it, e.g. > >    def read_package_names(open_text_file): >        """Read lines, strip any comments and r

Re: [Tutor] Iterating through a list of strings

2010-05-03 Thread Luke Paireepinart
> If that looks a bit clumsy, use a generator expression: > > linesToDelete = [x for x in lines if x.startswith('%')] > for x in linesToDelete: >   lines.remove(x) > > which idiomatically should probably become: > > for x in [y for y in lines if y.startswith('%')]: >   lines.remove(x) > > Hmm, why

Re: [Tutor] python list, right! but concretely?

2010-05-01 Thread Luke Paireepinart
2010/5/2 spir ☣ : > Hello, > > Is there anywhere some introduction material to the implementation of python > lists (or to fully dynamic and flexible sequences, in general)? > More precisely, I'd like to know what kind of base data-structure is used > (linked list, dynamic array, something else -

Re: [Tutor] Python beginner having troubles understanding word lists and character lists

2010-04-28 Thread Luke Paireepinart
On Wed, Apr 28, 2010 at 2:06 PM, Daniel wrote: > Hello, I'm a beginner programmer, trying to learn python. I'm currently > reading The programming > Historian,http://wiki.python.org/moin/BeginnersGuide/NonProgrammers > I stumbled into lists of words and lists of characters. I have no > explication

Re: [Tutor] Using Regex to produce text

2010-04-27 Thread Luke Paireepinart
On Wed, Apr 28, 2010 at 1:27 AM, wrote: > Dear All, > > Quick question: > > Is there an way of using the regex patterns to produce text, instead of > matching it? > > E.g.: > pat = re.compile("ab?d") > pat.getListofPossibleText() > There's no end to the length of many patterns so this would be

Re: [Tutor] (no subject)

2010-04-27 Thread Luke Paireepinart
On Tue, Apr 27, 2010 at 10:12 PM, Marco Rompré wrote: > Oups my posting was too big!!! > > On Tue, Apr 27, 2010 at 11:04 PM, Marco Rompré > wrote: >> >> Why is none of my items button works In this, I have two files and in >> my second file I imported all the function of the first one >> >> H

[Tutor] Changing Default Install Path on Windows

2010-04-21 Thread Luke Paireepinart
Hi guys, my first post to the list with a question rather than a response in a few years, I think :) (NOTE: I solved my question while writing this e-mail, I'm just mailing this to the list for future users now) I'm running Windows 7 64-bit. I currently have 3 python installs. First I installed

Re: [Tutor] the binary math "wall"

2010-04-20 Thread Luke Paireepinart
On Tue, Apr 20, 2010 at 11:58 AM, Lowell Tackett wrote: > I'm running headlong into the dilemma of binary math representation, with > game-ending consequences, e.g.: > 0.15 > 0.14999 > > Obviously, any attempts to manipulate this value, under the misguided > assumption that it i

Re: [Tutor] Prime numbers

2010-03-28 Thread Luke Paireepinart
On Sat, Mar 27, 2010 at 5:08 PM, yd wrote: > > Having a problem finding the first 1000 prime numbers, here is my code:- > > print(2) > n =3 > counter =1 > while counter <=1000: > for x in range(3,int((n**0.5)),2): > if n%x != 0: > print(n) > n+=1 > counter+=1 > else: >

  1   2   3   4   5   6   7   8   >