Returning a variable number of things...

2009-02-06 Thread r0g
Hi There, I have a function that uses *args to accept a variable number of parameters and I would like it to return a variable number of objects. I could return a list but I would like to take advantage of tuple unpacking with the return values e.g. def unpack_struct( a_string, *args ): output

Re: Returning a variable number of things...

2009-02-06 Thread r0g
Chris Rebert wrote: > On Fri, Feb 6, 2009 at 10:50 AM, r0g wrote: >> Hi There, >> >> I have a function that uses *args to accept a variable number of >> parameters and I would like it to return a variable number of objects. >> >> I could return a list but

Functional schmunctional...

2009-02-10 Thread r0g
I remember being forced to do a bit of functional programming in ML back at Uni in the mid 90, the lecturers were all in a froth about it and I must admit the code was elegant to look at. The problem was the dog slow performance for anything half practical, especially with recursion being the techn

Re: Python Module: nift

2009-02-10 Thread r0g
J wrote: > Thanks for your answers, especially Chris Rebert and Paul McGuire's. I > have a question: > How far does Python go in the Game Development field? (Using Python > only, no extensions) Hey J, Python's all about the libraries (extensions), you won't be able to do much without them but th

Re: Replace unknow string varible in file.

2009-02-10 Thread r0g
namire wrote: > Just as a comparison in the Windows OS this seems easy to do when > managing files, say for the file a-blah-b-blah.tmp where blah is an > unknown you can use: del a-*-b-*.tmp to get rid of that file. But for > python and a string in text file I don't have a clue. @_@ could > someone

Re: Functional schmunctional...

2009-02-10 Thread r0g
bearophileh...@lycos.com wrote: > Here a small benchmark: > > def ip2inet01(a): # can't be used with 6 > li = a.split('.') Wow, thanks everybody for all the suggestions, v.interesting esp as I didn't even ask for any suggestions! This is a fantastically didactic newsgroup: you start off jus

Escaping my own chroot...

2009-02-10 Thread r0g
I'm writing a linux remastering script in python where I need to chroot into a folder, run some system commands and then come out and do some tidying up, un-mounting proc & sys etc. I got in there with os.chroot() and I tried using that to get back out but that didn't work so... is my script trapp

Re: Need help converting text to csv format

2008-11-23 Thread r0g
John Machin wrote: > On Nov 22, 11:04 am, r0g <[EMAIL PROTECTED]> wrote: >>>>>>>> On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: >>>>>>>>> Any help, pseudo code, or whatever push in the right direction would >&g

Security implications of using open() on untrusted strings.

2008-11-23 Thread r0g
Hi there, I'm trying to validate some user input which is for the most part simple regexery however I would like to check filenames and I would like this code to be multiplatform. I had hoped the os module would have a function that would tell me if a proposed filename would be valid on the host

Re: Installing python 2.6 on Vista

2008-11-23 Thread r0g
Glenn Linderman wrote: > On approximately 11/23/2008 9:17 PM, came the following characters from > the keyboard of GALLOWAY Stuart J (SVHM): > > But, hey, a portable version of Python would be nice! Would probably > make the job of the various packagers that make .exe files easier, too! Erm, a c

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread r0g
Steven D'Aprano wrote: > On Mon, 24 Nov 2008 00:44:45 -0500, r0g wrote: > >> Hi there, >> >> I'm trying to validate some user input which is for the most part simple >> regexery however I would like to check filenames and I would like this >> code

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread r0g
Jorgen Grahn wrote: > On Mon, 24 Nov 2008 00:44:45 -0500, r0g <[EMAIL PROTECTED]> wrote: >> Hi there, >> >> I'm trying to validate some user input which is for the most part simple >> regexery however I would like to check filenames and I would like this &g

Re: How to get a directory file descriptor?

2008-11-24 Thread r0g
Cong Ma wrote: > Dear all, > > Can you give me some hint on getting a directory file descriptor in Python? > Besides, what's good about os.fchdir() if I can't get a directory fd in the > first place? > > Thanks for your reply. > > Regards, > Cong. > for each in os.listdir(os.getcwd()): print

Re: How to get a directory file descriptor?

2008-11-25 Thread r0g
Cong Ma wrote: > r0g wrote: >> Cong Ma wrote: >>> Dear all, >>> >>> Can you give me some hint on getting a directory file descriptor in Python? >>> Besides, what's good about os.fchdir() if I can't get a directory fd in the >>> first

Re: How to get a directory file descriptor?

2008-11-25 Thread r0g
r0g wrote: > Cong Ma wrote: >> r0g wrote: >>> Cong Ma wrote: >>>> Dear all, >>>> >>>> Can you give me some hint on getting a directory file descriptor in Python? >>>> Besides, what's good about os.fchdir() if I can't

rejecting newlines with re.match

2008-11-26 Thread r0g
Hi, I want to use a regex to match a string "poo" but not "poo\n" or "poo"+chr(13) or "poo"+chr(10) or "poo"+chr(10)+chr(13) According to http://docs.python.org/library/re.html '.' (Dot.) In the default mode, this matches any character except a newline. If the DOTALL flag has been specified, thi

Progressive download with Urllib2.

2008-12-05 Thread r0g
Hi There, I am trying to download some video with python but have run aground on the rocky shores of pseudostreaming. Fingers crossed someone else here has some experience with this! Here's what I've done so far... The initial link is foo.asx so I download that with... handle = urllib2.urlopen(

Re: Quick Newbie Question

2008-12-05 Thread r0g
Josh wrote: > Can Python be used on one Linux machine to drive another Linux machine > through SSH? I am currently running Putty on my XP box to run tests on a > Linux box. I need to automate these tests and thought it would be fun to > do so from a Linux VMWare Image I recently setup. Does this s

Re: Equivalent of 'wget' for python?

2008-12-08 Thread r0g
Robert Dailey wrote: > Hi, > > I'm looking for a portable way to download ZIP files on the internet > through Python. I don't want to do os.system() to invoke 'wget', since > this isn't portable on Windows. I'm hoping the core python library has > a library for this. Note that I'll be using Python

Re: How to Write to csv file to create bulk address book

2008-12-08 Thread r0g
k.i.n.g. wrote: > Hi , > > I am new to scripting, I am working on script which would create 'n' > number address book entries into a csv file which would be used to > import into a address book. I need suggestions for the same > > The fileds for csv file are as follows > > ""Title","First Name"

Re: [Python-Dev] "as" keyword woes

2008-12-08 Thread r0g
Virgil Dupras wrote: > On 06 Dec 2008, at 20:38, Warren DeLano wrote: > As long as "as" is widely known as a keyword, I don't see the problem. > Every python developer knows that the convention is to add a trailing > underscore when you want to use a reserved word in your code. Ooo, actually I di

Re: Text parsing via regex

2008-12-08 Thread r0g
Robocop wrote: > I'm having a little text parsing problem that i think would be really > quick to troubleshoot for someone more versed in python and Regexes. > I need to write a simple script that parses some arbitrarily long > string every 50 characters, and does not parse text in the middle of >

Good practice when writing modules...

2008-11-15 Thread r0g
I'm collecting together a bunch of fairly random useful functions I have written over the years into a module. Generally speaking is it best to a) Import all the other modules these functions depend on into the modules global namespace by putting them at the top of the module or should I... b) In

Re: Good practice when writing modules...

2008-11-15 Thread r0g
[EMAIL PROTECTED] wrote: > r0g: >> a) Import all the other modules these functions depend on into the >> modules global namespace by putting them at the top of the module or >> should I... >> b) Include them in each function individually. > > This is a interesti

Re: Suggestions for an education programming project

2008-11-17 Thread r0g
Eric wrote: > On Nov 17, 1:06 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: >> Eric <[EMAIL PROTECTED]> writes: >>> Hi, >>> I've been trying to get my son interested in learning some simple >>> programming for a while. While I understand that a structured tutorial >>> is best, I think if we can w

How to deal with globals during refactoring classes into separate files.

2008-11-18 Thread r0g
Hi There, I'm refactoring some old code that uses global variables and was originally written in one big flat file with a view to nicening it up and then extending it. The problem I have though is when I move the various classes out to their own separate files and reimport them back in they can't

Re: How to deal with globals during refactoring classes into separate files.

2008-11-19 Thread r0g
r0g wrote: > Hi There, > > I'm refactoring some old code that uses global variables and was > originally written in one big flat file with a view to nicening it up > and then extending it. The problem I have though is when I move the Hi Chris / Gabriel, Thanks v.much, tha

Using eval, or something like it...

2008-11-19 Thread r0g
Hi There, I know you can use eval to dynamically generate the name of a function you may want to call. Can it (or some equivalent method) also be used to do the same thing for the variables of a class e.g. class Foo(): bar = 1 gum = 2 mylist = ['bar','gum'] a = Foo() for each in mylist: a

Re: Using eval, or something like it...

2008-11-19 Thread r0g
George Sakkis wrote: > On Nov 19, 7:44 pm, r0g <[EMAIL PROTECTED]> wrote: >> Hi There, >> >> I know you can use eval to dynamically generate the name of a function >> you may want to call. Can it (or some equivalent method) also be used to >> do the same

Re: Using eval, or something like it...

2008-11-19 Thread r0g
John Machin wrote: > On Nov 20, 11:44 am, r0g <[EMAIL PROTECTED]> wrote: >> Hi There, >> >> I know you can use eval to dynamically generate the name of a function >> you may want to call. Can it (or some equivalent method) also be used to >> do the same

Re: Air Force1 and Air Jordan shoes PAYPAL wholesale

2008-11-20 Thread r0g
Pierre-Alain Dorange wrote: > air force1 shoes <[EMAIL PROTECTED]> wrote: > air force1 shoes. air force1 high shoes. air force1 light shoes > File "", line 1 > air force1 shoes. air force1 high shoes. air force1 light shoes > ^ > SyntaxError: invalid syntax > > LOL! X0D

Re: Programming exercises/challenges

2008-11-20 Thread r0g
Edwin wrote: > On Nov 18, 6:39 pm, [EMAIL PROTECTED] wrote: >> Hi guys, >> >> I'm learning Python by teaching myself, and after going through several >> tutorials I feel like I've learned the basics. Since I'm not taking a >> class or anything, I've been doing challenges/programs to reinforce the >

Re: Using eval, or something like it...

2008-11-20 Thread r0g
Scott David Daniels wrote: > r0g wrote: >> John Machin wrote: >>> You mention "variables of a class" but you then proceed to poke >>> at an instance of the class >>> Check out setattr (and getattr) in the docs. >> The former

Re: Sending username password to a webpage

2008-11-20 Thread r0g
KDawg44 wrote: > Hi, > > Is there a way to essentially simulate populating a text box and > calling a submit button on a webpage? I want to write an app that > gets a users information from a website and then uses that to get > information from another site. The first site requires a log in. >

Re: Using eval, or something like it...

2008-11-21 Thread r0g
Scott David Daniels wrote: > r0g wrote: >> ... >> A class is like a template which combines a complex data type (made from >> a combination of other data types) and the methods that operate on that >> data type. >> >> You generally don't work with classe

Re: Need help converting text to csv format

2008-11-21 Thread r0g
Chuck Connors wrote: > Hey guys. I'm working on a little program to help my wife catalog her/ > our coupons. I found a good resource but need help formatting the > text data so that I can import it into a mysql database. Here's the > data format: > > 40922003 Life Fitness Products $1 (12-13-

Re: Using eval, or something like it...

2008-11-21 Thread r0g
Scott David Daniels wrote: > I forgot to include a few cases: > > (1) Inspired by your calling the class attributes "templates": I did no such thing, I likened classes to templates and as far as I can tell they are _like_ templates albeit dynamic ones. > class Demo3(object): > All the abov

Re: Need help converting text to csv format

2008-11-21 Thread r0g
>> On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote: >>> Any help, pseudo code, or whatever push in the right direction would >>> be most appreciated. I am a novice Python programmer but I do have a >>> good bit of PHP programming experience. John Machin wrote: > If

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread r0g
Martin v. Löwis wrote: >> In any case, my concern with dropping a stock python itanium distro >> involves the vastly diminished probability that others will provide >> Itanium versions of, for example py2exe and pywin32. > > Well, I had been providing Itanium binaries for 2.4 and 2.5, and neither

Re: Converting .py files to batch files.

2008-09-17 Thread r0g
Michael Palmer wrote: > On Sep 15, 3:04 pm, Matias Surdi <[EMAIL PROTECTED]> wrote: >> aditya shukla escribió: >> >>> How can we convert .py files to batch files? is there any library for this? >>> Aditya >>> > On Linux, you w

Re: Client server implementation

2008-09-17 Thread r0g
Babloo wrote: > On Sep 16, 7:38 am, Benjamin <[EMAIL PROTECTED]> wrote: >> On Sep 15, 5:15 am, Babloo <[EMAIL PROTECTED]> wrote: >> >>> Hi everyone, >>> i wanted to implement a client- server connection >>> and transfer a file over the network. i was able to implement a normal >>>

Re: Python GUI for animation

2008-09-17 Thread r0g
Sean DiZazzo wrote: > On Sep 15, 11:29 pm, Virgil Stokes <[EMAIL PROTECTED]> wrote: >> I have been using Python for a short time and I find it a very flexible >> language, and easy to learn and use. I have also worked some with PyGame > Then again, you mention sliders, knobs, etc. I don't think T

Re: File Reading related query

2008-09-17 Thread r0g
Fredrik Lundh wrote: > Usman Ajmal wrote: > >> Is there any function for reading a file while ignoring *\n* occuring >> in the file? > > can you be a bit more precise? are we talking about text files or > binary files? how do you want to treat any newlines that actually > appear in the file? >

Re: Converting .py files to batch files.

2008-09-17 Thread r0g
Grant Edwards wrote: > On 2008-09-17, r0g <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED]:~/Desktop/py$ ls >> kickstart.py kickstart.py~ kicktest.py kicktest.py~ >> [EMAIL PROTECTED]:~/Desktop/py$ kickstart.py >> bash: kickstart.py: command not fou

Re: A unique instance of Python GUI program

2008-09-17 Thread r0g
akineko wrote: > Again, thank you for many postings to my question. > I have reviewed solutions provided. > Well, I like the named Mutex solution under Windows. > That is a clean and straight-forward approach to the challenge. > (I cannot believe that I'm saying good thing about Windows ;-) ) > >

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread r0g
erikcw wrote: > Hi, > > I have a cgi script where users are uploading large files for > processing. I want to launch a subprocess to process the file so the > user doesn't have to wait for the page to load. > > What is the correct way to launch subprocess without waiting for the > result to retu

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread r0g
erikcw wrote: > Hi, > > I have a cgi script where users are uploading large files for > processing. I want to launch a subprocess to process the file so the > user doesn't have to wait for the page to load. > > What is the correct way to launch subprocess without waiting for the > result to retu

Re: Linq to Python

2008-09-24 Thread r0g
[EMAIL PROTECTED] wrote: > sturlamolden: >> No, because Python already has list comprehensions and we don't need the XML >> buzzword.< > > LINQ is more than buzzwords. Python misses several of those features. > So maybe for once the Python crowd may recognize such C# feature as > much better than

Re: multiple processes, private working directories

2008-09-24 Thread r0g
Tim Arnold wrote: > I have a bunch of processes to run and each one needs its own working > directory. I'd also like to know when all of the processes are > finished. > > (1) First thought was threads, until I saw that os.chdir was process- > global. > (2) Next thought was fork, but I don't know h

Re: Linq to Python

2008-09-24 Thread r0g
Duncan Booth wrote: > r0g <[EMAIL PROTECTED]> wrote: > >> OK so maybe I'm being naive here but it looks to me like this new >> paradigm's big idea is to use a python + SQL type syntax to access data >> in random objects. Big whoop. It's not that diff

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-26 Thread r0g
process wrote: > ' '.join([`x * x` for x in range(1, 6)]) > > exactly what does this symbol do and what does it stand for? Which symbol, the '*' ??? Are you kidding? -- http://mail.python.org/mailman/listinfo/python-list

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-26 Thread r0g
process wrote: > ' '.join([`x * x` for x in range(1, 6)]) > > exactly what does this symbol do and what does it stand for? Ah, just spotted the backticks - they just return whatever's inside them as a string. -- http://mail.python.org/mailman/listinfo/python-list

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-26 Thread r0g
Diez B. Roggisch wrote: >> that is a very valid point, but it seemed that Scott has homogeneous >> environment: Debian/Ubuntu so my post was relative to the original >> request. >> I agree that when you throw Windows/MacOS into the mix things >> become "interesting". But then it's better when your

Re: How to get the filename in the right case ?

2008-09-26 Thread r0g
Steven D'Aprano wrote: > On Fri, 26 Sep 2008 01:46:15 +0200, Stef Mientki wrote: > >> Secondly thoughtless copying of current behavior, doesn't bring any >> progress, >> and I think that's one of the reasons why we're still burdened by >> inventions done 20 years ago, >> e.g. "do you want to save

Re: Python is slow?

2008-09-29 Thread r0g
[EMAIL PROTECTED] wrote: > Lawrence D'Oliveiro: >>> Gnuplot is non-Free software. > > Fly Away: >> Yes, it is. > > From: > http://www.gnuplot.info/faq/faq.txt > > 1.7 Does gnuplot have anything to do with the FSF and the GNU project? >[...] >Gnuplot is freeware in the sense that you don'

Re: Python is slow?

2008-09-30 Thread r0g
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, r0g wrote: > >> You can only distribute modifications to gnuplot itself as >> patches, but you can distribute it freely ... > > This must be some new definition of "freely" of which I'

Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
Hi, I'm writing a reliability monitoring app but I've run into a problem. I was hoping to keep it very simple and single threaded at first but that's looking unlikely now! The crux of it is this... gethostbyname ignores setdefaulttimeout. It seems gethostbyname asks the OS to resolve the address

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
John Bokma wrote: > r0g wrote: > >> It seems gethostbyname asks the OS to resolve the address and the OS >> uses it's own timeout value ( 25 seconds ) rather than the one provided >> in setdefaulttimeout. 25 seconds of blocking is way too long for me, I >> wa

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
Gabriel Genellina wrote: > En Fri, 27 Nov 2009 22:35:36 -0300, r0g > escribió: > >> gethostbyname ignores setdefaulttimeout. >> >> How big a job is it to use non-blocking sockets to write a DNS lookup >> function with a customisable timeout? A few lines? A

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
r0g wrote: > Gabriel Genellina wrote: >> En Fri, 27 Nov 2009 22:35:36 -0300, r0g >> escribió: >> >>> gethostbyname ignores setdefaulttimeout. >>> >>> How big a job is it to use non-blocking sockets to write a DNS lookup >>> function wit

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-29 Thread r0g
r0g wrote: > r0g wrote: >> Gabriel Genellina wrote: >>> En Fri, 27 Nov 2009 22:35:36 -0300, r0g >>> escribió: >>> >>>> gethostbyname ignores setdefaulttimeout. >>>> >>>> How big a job is it to use non-blocking sockets to writ

Re: Creating a local variable scope.

2009-11-30 Thread r0g
markolopa wrote: > On Nov 30, 4:46 am, Dave Angel wrote: >> markolopa wrote: >> or >> whether you accidentally reused the same name without giving it a new >> value in the new loop. > > That is what I do regularly...8-> > Well really dude, you need to stop doing that. It's not a language p

Re: Beginner Q. interrogate html object OR file search?

2009-12-02 Thread r0g
Mark G wrote: > Hi all, > > I am new to python and don't yet know the libraries well. What would > be the best way to approach this problem: I have a html file parsing > script - the file sits on my harddrive. I want to extract the date > modified from the meta-data. Should I read through lines of

Re: Bored.

2009-12-02 Thread r0g
Necronymouse wrote: > Thanks for reaction, I will prohably choose some project as you > said... > > > If you want to dip your toe in waters of open source contribution it looks like Gitso could use a little help pushing out their 0.6 release (which I just happen to quite want but don't have ti

Re: Creating a local variable scope.

2009-12-02 Thread r0g
Ben Finney wrote: > markolopa writes: > >> Hi Roger, >> > […] >>> Long, descriptive variable names all_in_lower_case >>> Function names all in CamelCase >>> Global names are in ALL CAPS >> yes, pep8 I guess. > > Not quite: it deviates from PEP 8 on function names, which should rather > be ‘lower

Re: Help in wxpython

2009-12-03 Thread r0g
Krishnakant wrote: > On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote: >> Hi >> >> I am trying to write an PAINT like application where on the mouse >> File "C:/Python26/circle.py", line 19, in InitBuffer >> dc=wx.BufferedDC(None,self.buffer) >> AttributeError: 'SketchWindow' obj

Re: pbs scripts

2009-12-03 Thread r0g
aoife wrote: > Hi,very new.hoping to incorporate python into my postgrad. > > Basically I have 2,000 files.I want to write a script that says: > > open each file in turn > for each file: >open this pbs script and run MUSCLE (a sequence alignment tool) > on each file >close this fi

Re: Question about file objects...

2009-12-03 Thread r0g
J wrote: > Something that came up in class... > > when you are pulling data from a file using f.next(), the file is read > one line at a time. > > What was explained to us is that Python iterates the file based on a > carriage return as the delimiter. > But what if you have a file that has one li

Re: Reading a file that is changing and getting the new lines

2009-12-03 Thread r0g
Ouray Viney wrote: > Hi: > > Problem: > = > I want to read a ASCII text file that can have data appended to it. I > have hacked some code together that handles the basics, but it falls > short. My code doesn't read in the new lines that could have been > added to the end of the file. No

Re: Question on Python as career

2009-12-03 Thread r0g
Tim Roberts wrote: > joy99 wrote: >> I am a researcher in India's one of the premier institutes.(Indian >> Institute of Science,Bangalore). >> >> I have done one MA in Linguistics, did a PhD in Natural Language >> Processing and doing a Post Doctoral now. >> ... >> After I complete my Post Doctora

Re: Question on Python as career

2009-12-03 Thread r0g
TimmyGee wrote: > On Dec 4, 2:48 am, Grant Edwards wrote: >> On 2009-12-03, r0g wrote: >> >>>>> I have done one MA in Linguistics, did a PhD in Natural >>>>> Language Processing and doing a Post Doctoral now. ... >>>>> After I compl

Re: More elegant solution for diffing two sequences

2009-12-03 Thread r0g
Lie Ryan wrote: > On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote: >> I'm trying to write some code to diff two fonts. What I have is every >> character (glyph) of the two fonts in a list. I know that the list is >> sorted >> by the codepoints of the characters. What I'd like to ask is whether >> there

Re: How to tell if you're running on windows?

2009-12-05 Thread r0g
Roy Smith wrote: > I'm using 2.5.1. How can I tell if I'm running on windows? The > obvious answer, platform.system(), gets complicated. On the python > that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I've got > a native windows build of python where it returns 'Microsoft'. > > Th

Re: Question on Python as career

2009-12-05 Thread r0g
TimmyGee wrote: > On Dec 4, 1:08 pm, r0g wrote: >> TimmyGee wrote: >>> On Dec 4, 2:48 am, Grant Edwards wrote: >>>> On 2009-12-03, r0g wrote: >>>>>>> I have done one MA in Linguistics, did a PhD in Natural >>>>>>> Languag

Re: Float precision and float equality

2009-12-06 Thread r0g
dbd wrote: > On Dec 6, 1:12 am, Raymond Hettinger wrote: >> On Dec 5, 11:42 pm, Tim Roberts wrote: >> >>> Raymond Hettinger wrote: if not round(x - y, 6): ... >>> That's a dangerous suggestion. It only works if x and y happen to be >>> roughly in the range of integers. > .> > .> Right.

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
elca wrote: > Hello ALL, > > i have some python proxy checker . > > and to speed up check, i was decided change to mutlthreaded version, > > and thread module is first for me, i was tried several times to convert to > thread version > > and look for many info, but it not so much easy for novic

Re: how to convert string function to string method?

2009-12-07 Thread r0g
Dr. Phillip M. Feldman wrote: > I wrote a handy-dandy function (see below) called "strip_pairs" for stripping > matching pairs of characters from the beginning and end of a string. This > function works, but I would like to be able to invoke it as a string method > rather than as a function. Is t

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
Terry Reedy wrote: > r0g wrote: > >> The trick to threads is to create a subclass of threading.Thread, define >> the 'run' function and call the 'start()' method. I find threading quite >> generally useful so I created this simple generic function fo

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
Terry Reedy wrote: > r0g wrote: > >> The trick to threads is to create a subclass of threading.Thread, define >> the 'run' function and call the 'start()' method. I find threading quite >> generally useful so I created this simple generic function fo

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
Rhodri James wrote: > On Mon, 07 Dec 2009 18:21:23 -, Terry Reedy wrote: > >> r0g wrote: >> >>> The trick to threads is to create a subclass of threading.Thread, define >>> the 'run' function and call the 'start()' method. I find threa

Re: question about imports in a class

2009-12-07 Thread r0g
Diez B. Roggisch wrote: > J schrieb: >> On Mon, Dec 7, 2009 at 16:57, Diez B. Roggisch >> wrote: >> if I put the import at the beginning of the class, it just dawned on me that perhaps I still have to explicitly call the function by class: > I'm not annoyed. I just wonder from what

Re: test if an input string starts with a python expression

2009-12-07 Thread r0g
Torsten Mohr wrote: > Hi, > > i'd like to test if an input string starts with a python expression > and also where that expression ends. An example: > > a_func(3*7, '''abc''') +5 pls some more > > The first part until (inclusive) the 5 should be found as an expression > and the length of that s

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread r0g
Dennis Lee Bieber wrote: > On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old > declaimed the following in gmane.comp.python.general: > >> For Kannada project .txt(not .doc) is used, my requirement is to have one >> In this context, I request you kindly for small python program - to make or > >

Re: python proxy checker ,change to threaded version

2009-12-08 Thread r0g
Lie Ryan wrote: > On 12/8/2009 8:43 AM, Rhodri James wrote: >>> >>> def run(self): >>> result = func(*func_args) # matching run_in_thread param names >>> callback(result, *callback_args) >> Neat, but I think you mean >> >> if callback is not None: >> callback(result, *callback_args) >> >> for that

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread r0g
Dave Angel wrote: > > > r0g wrote: >> Dennis Lee Bieber wrote: >> >>> On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old >>> declaimed the following in gmane.comp.python.general: >>> >>> >>>> For Kanna

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread r0g
Dave Angel wrote: > r0g wrote: >> Dave Angel wrote: >> >>> r0g wrote: >>> >>>> Dennis Lee Bieber wrote: >>>> >>>> >>>>> On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old >>>>> declaimed the

Re: Request for py program to insert space between two characters and saved as text?

2009-12-09 Thread r0g
Dave Angel wrote: > > > r0g wrote: >> Dave Angel wrote: >> >>> r0g wrote: >>> >>>> Dave Angel wrote: >>>> >>>> >>>>> r0g wrote: >>>>> >>&g

Re: How do I Block Events in wxPython

2009-12-09 Thread r0g
Wanderer wrote: > I have a wxPython program which does some calculations and displays > the results. During these calculations if I click the mouse inside the > dialog the program locks up. If I leave the dialog alone the process > completes fine. If anything in your GUI app takes a non trivial le

Re: Perl to Python conversion

2009-12-13 Thread r0g
Martin Schöön wrote: > Thanks all, great response! > > A little more background: > > I am not a programmer but I have done some programming in the past. > This was all humble number crunching as part of my PhD project using > FORTRAN. I also did some Rocky Mountain Basic coding for programs > man

Re: Moving from PHP to Python. Is it Possible

2009-12-14 Thread r0g
Bruno Desthuilliers wrote: > Sancar Saran a écrit : > (snip) >> My problem is with PHP syntax and performance. I'm just trying to >> replicate my recepies in python... > > Python is not PHP, and trying to write PHP in Python won't buy you much > except pain and frustration. I think people are b

Re: Seek support for new slice syntax PEP.

2009-12-15 Thread r0g
Terry Reedy wrote: > On 12/14/2009 1:10 PM, geremy condra wrote: >> http://www.python.org/dev/peps/pep-3003/ > > The moratorium does not stop proposals for things to be added after the > moratorium ends. But it does show that Guido and the devs are reluctant > to make *any* change to the core synt

Re: OS independent way to check if a python app is running?

2009-12-15 Thread r0g
pyt...@bdurham.com wrote: > LOL! Yes, I should of worded my original post better (meant to say "... > if a python app is already running". > > Enjoyed your post anyway - I'm still laughing :) > > Cheers, > Malcolm Quick and dirty way would be to keep a particular high numbered socket open. R

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread r0g
Gabriel Genellina wrote: > En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi > escribió: > >> I've googled, found where cookies are supposed to be, the folders and >> files >> don't exist. I've opened my latest and greatest FF and seen cookies in >> there, but when I search for the name of the c

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread r0g
r0g wrote: > Gabriel Genellina wrote: >> En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi >> escribió: >> >>> I've googled, found where cookies are supposed to be, the folders and >>> files >>> don't exist. I've opened my latest a

Re: pyZui - anyone know about this?

2009-12-16 Thread r0g
David Roberts wrote: > PyZUI 0.1 has been released: > > http://da.vidr.cc/projects/pyzui/ > Cool, thanks :) Roger. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrapping paper, anyone ?

2009-12-16 Thread r0g
Peter Otten wrote: > simon wrote: > > Nice :) > > --- stars.py2009-12-16 10:52:49.553505036 +0100 > +++ stars_fixed.py 2009-12-16 10:53:32.545786454 +0100 > @@ -48,7 +48,9 @@ > def __init__(self): > self.calls = [] > > -__getattr__ = ScribeCall > +def __getattr__(s

Re: Object Relational Mappers are evil (a meditation)

2009-12-16 Thread r0g
J Kenneth King wrote: > Steven D'Aprano writes: > >> On Fri, 11 Dec 2009 19:20:21 -0500, Steve Holden wrote: >> >>> Hear, hear! >> That's all very well, but some languages and techniques encourage the >> programmer to write bad code. > > That's just BS. > > Bad code doesn't just write itself

Re: Wrapping paper, anyone ?

2009-12-16 Thread r0g
simon wrote: > On Dec 17, 12:36 am, r0g wrote: >> Peter Otten wrote: >>> simon wrote: >>> Nice :) >>> --- stars.py2009-12-16 10:52:49.553505036 +0100 >>> +++ stars_fixed.py 2009-12-16 10:53:32.545786454 +0100 >>> @@ -48,7 +48,9 @

Re: Wrapping paper, anyone ?

2009-12-16 Thread r0g
bartc wrote: > > "simon" wrote in message > news:a50b1c21-287b-498d-a8c3-51a3a2f94...@k9g2000vbl.googlegroups.com... >> #!/usr/bin/env python >> >> from math import * >> >> from random import * >> >> import cairo >> from cairo import Context > > What's cairo? > > A vector graphics library.

Re: regex help

2009-12-16 Thread r0g
Gabriel Rossetti wrote: > Hello everyone, > > I'm going nuts with some regex, could someone please show me what I'm > doing wrong? > > I have an XMPP msg : > > > > Does someone know what is wrong with my expression? Thank you, Gabriel Gabriel, trying to debug a long regex in situ can be a

  1   2   >