Re: Need to import stuff

2010-08-17 Thread Abhijeet
Hi, Used imp. It worked. Thanks Daniel Kluev wrote: On Wed, Aug 18, 2010 at 9:40 AM, abhijeet thatte mailto:abhijeet.tha...@gmail.com>> wrote: Hi, Thanks for the reply. But I guess it does not support nested file paths. If user gives 'abcd' then I need to import "//*Do/S

Re: Need to import stuff

2010-08-17 Thread Daniel Kluev
On Wed, Aug 18, 2010 at 9:40 AM, abhijeet thatte wrote: > Hi, > > Thanks for the reply. But I guess it does not support nested file paths. > If user gives 'abcd' then I need to import "*/Do/Stuff/abcd*". Out of > which only *"abcd" is taken run time. Do and Stuff are fixed. * > *I got an error "*I

Re: String substitution VS proper mysql escaping

2010-08-17 Thread Cameron Simpson
On 17Aug2010 20:15, Νίκος wrote: | === | cursor.execute( ''' SELECT host, hits, date FROM visitors WHERE page = | '%s' ORDER BY date DESC ''' % (page) ) | === | | Someone told me NOT to do string substitution ("%") on SQL statements | and to

Re: String substitution VS proper mysql escaping

2010-08-17 Thread Daniel Kluev
2010/8/18 Νίκος > a) I wanted to ask what is proper escaping mean and > > Proper escaping means that value is wrapped in quotes properly, and quotes and backslashes (or any other special to RDBMS symbol) are escaped with backslashes. why after variable page syntax has a comma > Comma just means

String substitution VS proper mysql escaping

2010-08-17 Thread Νίκος
=== cursor.execute( ''' SELECT host, hits, date FROM visitors WHERE page = '%s' ORDER BY date DESC ''' % (page) ) === Someone told me NOT to do string substitution ("%") on SQL statements and to let MySQLdb do it for me, with proper escaping

Re: Python "why" questions

2010-08-17 Thread Russ P.
On Aug 7, 5:54 am, "D'Arcy J.M. Cain" wrote: > Would said beginner also be surprised that a newborn baby is zero years > old or would it be more natural to call them a one year old?  Zero > based counting is perfectly natural. You're confusing continuous and discrete variables. Time is a continu

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread John Passaniti
On Aug 17, 4:19 pm, Standish P wrote: > > > It is true that the other languages such as F/PS also have borrowed > > > lists from lisp in the name of nested-dictionaries and mathematica > > > calls them nested-tables as its fundamental data structure. > > > No. > > you are contradicting an earlier

Re: question about pdb assignment statements

2010-08-17 Thread Steve Ferg
Thanks mucho!! -- http://mail.python.org/mailman/listinfo/python-list

Re: update of elements in GUI

2010-08-17 Thread woooee
On Aug 16, 9:07 pm, Jah_Alarm wrote: > hi, I've already asked this question but so far the progress has been > small. > > I'm running Tkinter. I have some elements on the screen (Labels, most > importantly) which content has to be updated every iteration of the > algorithm run, e.g. "Iteration ="

Re: subprocess.Popen calling httpd reload never finishes

2010-08-17 Thread Albert Hopkins
On Tue, 2010-08-17 at 12:55 -0700, Nan wrote: > Hi folks -- > > I have a Python script running under Apache/mod_wsgi that needs to > reload Apache configs as part of its operation. The script continues > to execute after the subprocess.Popen call. The communicate() method > returns the correct t

Re: 0 length field in time string

2010-08-17 Thread MRAB
Rodrick Brown wrote: Anyone know why I'm getting the following error when trying to parse the following string is there a better method to use? #57=2010081708240065 - sample string passed to fmt_datetime def fmt_datetime(tag57): tag57 = tag57[3:len(tag57)] year= int ( tag57[0:

0 length field in time string

2010-08-17 Thread Rodrick Brown
Anyone know why I'm getting the following error when trying to parse the following string is there a better method to use? #57=2010081708240065 - sample string passed to fmt_datetime def fmt_datetime(tag57): tag57 = tag57[3:len(tag57)] year= int ( tag57[0:4] ) mon = int (

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On Aug 17, 2:29 am, Raymond Hettinger wrote: > I would like to see someone post a subclass to the ASPN Cookbook that > adds a number of interesting, though not common operations.  Your > symmetric_difference() method could be one.  A dot_product() operation > could be another.  Elementwise arithm

Fwd: Need to import stuff

2010-08-17 Thread abhijeet thatte
Hi, Thanks for the reply. But I guess it does not support nested file paths. If user gives 'abcd' then I need to import "*/Do/Stuff/abcd*". Out of which only *"abcd" is taken run time. Do and Stuff are fixed. * *I got an error "*ImportError: Import by filename is not supported.". Any solution?? O

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On Aug 17, 10:47 pm, Paddy wrote: > On 17 Aug, 02:29, Raymond Hettinger wrote: > > > > > [Paddy] > > > > Lets say you have two *sets* of integers representing two near-copies > > > of some system, then a measure of their difference could be calculated > > > as: > > > > len(X.symmetric_difference(

Re: Need to import stuff

2010-08-17 Thread Jerry Hill
On Tue, Aug 17, 2010 at 6:21 PM, abhijeet thatte wrote: > Hi, > I need to import few files depending on the user input. For eg if user gives > an input as "abcd" then I will have  import "abcd.py". > Can not have any hard coding in the code. Does any one know how to solve the > problem. Use the _

Need to import stuff

2010-08-17 Thread abhijeet thatte
Hi, I need to import few files depending on the user input. For eg if user gives an input as "abcd" then I will have * import "abcd.py".* Can not have any hard coding in the code. Does any one know how to solve the problem. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-17 Thread geremy condra
On Tue, Aug 17, 2010 at 7:59 AM, Lie Ryan wrote: > On 08/16/10 21:54, David Cournapeau wrote: >> On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing >> wrote: On Aug 7, 2010, at 9:14 PM, John Nagle wrote: >  The languages which have real multidimensional arrays, rather > than arrays

Re: 79 chars or more?

2010-08-17 Thread Nobody
On Mon, 16 Aug 2010 22:35:49 -0400, AK wrote: > As monitors are getting bigger, is there a general change in opinion on > the 79 chars limit in source files? I've experimented with 98 characters > per line and I find it quite a bit more comfortable to work with that > length, even though sometimes

Re: Python "why" questions

2010-08-17 Thread Roy Smith
In article <4c6a8cf...@dnews.tpgi.com.au>, Lie Ryan wrote: > On 08/16/10 21:54, David Cournapeau wrote: > > On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing > > wrote: > >>> On Aug 7, 2010, at 9:14 PM, John Nagle wrote: > >>> > The languages which have real multidimensional arrays, rather >

Re: Python "why" questions

2010-08-17 Thread Roy Smith
In article , Martin Gregorie wrote: > > Roy wasn't using numpy/Python semantics but made-up semantics (following > > Martin Gregorie's made-up semantics to which he was replying) which > > treat the step size as a true size, not a size and direction. The > > direction is determined from the star

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On 17 Aug, 02:29, Raymond Hettinger wrote: > [Paddy] > > > Lets say you have two *sets* of integers representing two near-copies > > of some system, then a measure of their difference could be calculated > > as: > > > len(X.symmetric_difference(Y)) / (len(X) + len(Y)) * 100 % > > > If the two coll

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-17 Thread Baba
On Aug 16, 6:28 pm, "cbr...@cbrownsystems.com" wrote: > First, suppose d = gcd(x, y, z); then for some x', y', z' we have that > x = d*x', y = d*y', z = d*z'; and so for any a, b, c: > could you explain the notation? what is the difference btw x and x' ? what is x = d*x', y supposed

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-17 Thread Thomas Jollans
On Tuesday 17 August 2010, it occurred to ata.jaf to exclaim: > I am developing a little program in Mac with wxPython. > But I have problems with the characters that are not in ASCII. Like > some special characters in French or Turkish. > So I am looking for a way to solve this. Like an encoding st

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Elizabeth D Rather
On 8/17/10 10:19 AM, Standish P wrote: On Aug 17, 12:32 pm, John Passaniti wrote: ... It is true that the other languages such as F/PS also have borrowed lists from lisp in the name of nested-dictionaries and mathematica calls them nested-tables as its fundamental data structure. No. you a

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
On Aug 17, 1:19 pm, Standish P wrote: > On Aug 17, 12:32 pm, John Passaniti wrote: > > > > > > > On Aug 17, 2:53 pm, Standish P wrote: > > > > Another way to pose my question, as occurred to me presently is > > > to ask if a stack is a good abstraction for programming ? > > > Certainly, it is th

Looking for an appropriate encoding standard that supports all languages

2010-08-17 Thread ata.jaf
I am developing a little program in Mac with wxPython. But I have problems with the characters that are not in ASCII. Like some special characters in French or Turkish. So I am looking for a way to solve this. Like an encoding standard that supports all languages. Or some other way. Thanks Ata Jaf

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
On Aug 17, 12:32 pm, John Passaniti wrote: > On Aug 17, 2:53 pm, Standish P wrote: > > > Another way to pose my question, as occurred to me presently is > > to ask if a stack is a good abstraction for programming ? > > Certainly, it is the main abstraction in Forth and Postscript > > and implemen

Re: Open a command pipe for reading

2010-08-17 Thread Thomas Jollans
On Tuesday 17 August 2010, it occurred to Rodrick Brown to exclaim: > I have a fairly large file 1-2GB in size that I need to process line by > line but I first need to convert the file to text using a 3rd party tool > that prints the records also line by line. > > I've tried using Popen to do thi

subprocess.Popen calling httpd reload never finishes

2010-08-17 Thread Nan
Hi folks -- I have a Python script running under Apache/mod_wsgi that needs to reload Apache configs as part of its operation. The script continues to execute after the subprocess.Popen call. The communicate() method returns the correct text ("Reloading httpd: [ OK ]"), and I get a returncode

Re: Open a command pipe for reading

2010-08-17 Thread Chris Rebert
On Tue, Aug 17, 2010 at 9:40 AM, Rodrick Brown wrote: > I have a fairly large file 1-2GB in size that I need to process line by line > but I first need to convert the file to text using a 3rd party tool that > prints the records also line by line. > > I've tried using Popen to do this with no lu

Python 2.6.6 release candidate 2 now available.

2010-08-17 Thread Barry Warsaw
Hello fellow Python enthusiasts, The source tarballs and Windows installers for the second (and hopefully last) Python 2.6.6 release candidate is now available: http://www.python.org/download/releases/2.6.6/ We've had a handful of important fixes since rc1, and of course a huge number of bug

Re: 79 chars or more?

2010-08-17 Thread AK
On 08/17/2010 03:32 PM, Stefan Schwarzer wrote: Hi Andrei, On 2010-08-17 18:43, AK wrote: But let me ask you, would you really prefer to have: self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%d%Y') (o

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
Hi Andrei, On 2010-08-17 18:43, AK wrote: > But let me ask you, would you really prefer to have: > self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%d%Y') > > (or the 4-line version of this abov

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread John Passaniti
On Aug 17, 2:53 pm, Standish P wrote: > Another way to pose my question, as occurred to me presently is > to ask if a stack is a good abstraction for programming ? > Certainly, it is the main abstraction in Forth and Postscript > and implementable readily in C,C++ and I assume python. A stack is

Re: 79 chars or more?

2010-08-17 Thread Almar Klein
> If the display is limited to 80 characters then after printing the 80th > the cursor will be at the start of the next line and the newline will > cause the display to leave a blank line (unless the display has some > intelligence and supports pending newlines, of course). Ahah! So Windows users

Re: 79 chars or more?

2010-08-17 Thread Almar Klein
> > A reason not mentioned much is that some people have trouble following > packed lines that are too much longer. Wide-page textbooks routinely put > text in two columns for easier reading. This is less of a factor with jagged > edge text, but if the limit were increased to say 150, there would b

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread John Kelly
On Tue, 17 Aug 2010 11:53:27 -0700 (PDT), Standish P wrote: >Another way to pose my question, as occurred to me presently is to ask >if a stack is a good abstraction for programming ? Certainly, it is >the main abstraction in Forth and Postscript and implementable readily >in C,C++ and I assume p

Re: Opposite of split

2010-08-17 Thread News123
On 08/17/2010 05:46 PM, Grant Edwards wrote: > On 2010-08-17, Neil Cerutti wrote: >> On 2010-08-17, Stefan Schwarzer wrote: >>> Hi Alex, >>> >>> On 2010-08-16 18:44, Alex van der Spek wrote: Anybody catches any other ways to improve my program (attached), you are most welcome. Help me

Re: bash: syntax error near unexpected token

2010-08-17 Thread Hans Mulder
Benjamin Kaplan wrote: On Mon, Aug 16, 2010 at 11:33 PM, kreglet wrote: desktop:~/bin$ modtest.py desktop:~/bin$ evenodd(45) bash: syntax error near unexpected token `45' And this is what's supposed to happen any time you try this in any shell. When you call evenodd, bash looks for a progr

Re: 79 chars or more?

2010-08-17 Thread Terry Reedy
On 8/17/2010 3:47 AM, Lawrence D'Oliveiro wrote: In message, AK wrote: As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? WHAT 79-character limit in source files? Only for stdlib. Python itself has no particular limit. The dev discus

Re: 79 chars or more?

2010-08-17 Thread MRAB
Almar Klein wrote: [snip] I am in favor of the 80-char limit also. Besides the arguments listed above, when using an IDE it gives you that extra horizontal space to fit some IDE specific tools (such as source structure). I must admit that I'm sometimes slightly frustrated when an expressi

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
On Aug 16, 12:20 am, Standish P wrote: > [Q] How far can stack [LIFO] solve do automatic garbage collection and > prevent memory leak ? > Because a stack has push and pop, it is able to release and allocate > memory. We envisage an exogenous stack which has malloc() associated > with a push and f

Re: 79 chars or more?

2010-08-17 Thread Terry Reedy
On 8/17/2010 2:26 PM, Almar Klein wrote: On a related note, why is the limit mentioned in PEP8 79 chars, and not 80? I never understood this :) A newline char or block or underline cursor makes 80. The importance depended on the terminal. 80 chars on the last line could especially be a probl

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Brad
On Aug 17, 10:34 am, Standish P wrote: > On Aug 16, 11:09 am, Elizabeth D Rather wrote: > > How are these heaps being implemented ? Is there some illustrative > code or a book showing how to implement these heaps in C for example ? > Forth does not use a heap, except maybe to implement malloc/fre

Re: 79 chars or more?

2010-08-17 Thread Almar Klein
On 17 August 2010 18:43, AK wrote: > On 08/17/2010 12:21 PM, Stefan Schwarzer wrote: > >> On 2010-08-17 17:44, AK wrote: >> >>> On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: >>> I'd probably reformat this to self.expiration_date = translate_date( find

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
On Aug 17, 1:17 am, torb...@diku.dk (Torben Ægidius Mogensen) wrote: > Standish P writes: > > [Q] How far can stack [LIFO] solve do automatic garbage collection and > > prevent memory leak ? > > > Because a stack has push and pop, it is able to release and allocate > > memory. We envisage an exoge

[SOLVED]: Copying a file with a question mark in it's name in Windows

2010-08-17 Thread drodrig
On Aug 12, 9:16 am, Aleksey wrote: > On 12 авг, 18:49,drodrig wrote: > > > A python script I use to backup files on a Windows 2003 server > > occasionally fails to retrieve the size of a file with a question mark > > in the name. The exception I get is "OSError #123 The filename, > > directory nam

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread James Kanze
On Aug 17, 6:21 pm, Standish P wrote: > > Garbage collection doesn't use a stack. It uses a "heap", > > which is in the abstract a collection of memory blocks of > > different lengths, divided into two lists, generally > > represented as linked lists: > > 1. A list of blocks that are free and ma

Re: Python "why" questions

2010-08-17 Thread Martin Gregorie
On Tue, 17 Aug 2010 10:22:27 -0500, Robert Kern wrote: > On 8/16/10 11:10 PM, Steven D'Aprano wrote: >> On Mon, 16 Aug 2010 22:56:20 -0500, Robert Kern wrote: >> >>> On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: > In message, Roy Smith > wr

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
On Aug 16, 11:09 am, Elizabeth D Rather wrote: > On 8/15/10 10:33 PM, Standish P wrote: > > >>> If Forth is a general processing language based on stack, is it > >>> possible to convert any and all algorithms to stack based ones and > >>> thus avoid memory leaks since a pop automatically releases

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
> Garbage collection doesn't use a stack. It uses a "heap", which is in > the abstract a collection of memory blocks of different lengths, > divided into two lists, generally represented as linked lists: > > 1.  A list of blocks that are free and may be used to store new data > > 2.  A list of blo

Re: passing variables as object attributes

2010-08-17 Thread Vikas Mahajan
I got the concept to get and set object attributes and now can handle similar problems effectively. Thanks to all for your help. -- http://mail.python.org/mailman/listinfo/python-list

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-17 Thread Standish P
On Aug 16, 4:20 am, Malcolm McLean wrote: > On Aug 16, 10:20 am, Standish P wrote:> [Q] How far can > stack [LIFO] solve do automatic garbage collection and > > prevent memory leak ? > > Most programs can be written so that most of their memory allocations > are matched by destructors at the sam

Re: 79 chars or more?

2010-08-17 Thread Neil Cerutti
On 2010-08-17, AK wrote: > After all, I think it's a matter of balance between > readability, expressiveness and succinctness. If I split a > function in two, that still means that understanding the > functionality of the code will require scrolling around and > looking at the second function. I g

Re: 79 chars or more?

2010-08-17 Thread AK
On 08/17/2010 12:21 PM, Stefan Schwarzer wrote: On 2010-08-17 17:44, AK wrote: On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: I'd probably reformat this to self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%

Open a command pipe for reading

2010-08-17 Thread Rodrick Brown
I have a fairly large file 1-2GB in size that I need to process line by line but I first need to convert the file to text using a 3rd party tool that prints the records also line by line. I've tried using Popen to do this with no luck. I'm trying to simulate /bin/foo myfile.dat And as the re

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
On 2010-08-17 17:44, AK wrote: > On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: >> I'd probably reformat this to >> >>self.expiration_date = translate_date( >> find(response, 'MPNExpirationDate').text, >> '%Y-%m-%d', '%m%d%Y') >> >> or even >> >>se

Python Developer - HFT Trading firm - Chicago, IL

2010-08-17 Thread Rich Moss
Python developer needed for math/trading applications and research at leading HFT firm. The person we are searching for will have a strong background with python programming and the ability to work with very large historical datasets. You should have a very strong math background as well. This can

Re: Opposite of split

2010-08-17 Thread Grant Edwards
On 2010-08-17, Neil Cerutti wrote: > On 2010-08-17, Stefan Schwarzer wrote: >> Hi Alex, >> >> On 2010-08-16 18:44, Alex van der Spek wrote: >>> Anybody catches any other ways to improve my program (attached), you are >>> most welcome. Help me learn, that is one of the objectives of this >>> new

Re: EOFError with fileinput

2010-08-17 Thread Alex van der Spek
Thanks all! I understand better now. I had no idea that EOFError was an exception. I was looking for a function to tell me when the end of a sequential file is reached as in all of the 4 programming languages that I do know this is a requirement. Will modify my program accordingly. Alex van d

Re: 79 chars or more?

2010-08-17 Thread D'Arcy J.M. Cain
On Tue, 17 Aug 2010 16:28:02 +0200 Stefan Schwarzer wrote: > I'd probably reformat this to > > self.expiration_date = translate_date( > find(response, 'MPNExpirationDate').text, > '%Y-%m-%d', '%m%d%Y') > > or even > > self.expiration_date = translate_

Re: 79 chars or more?

2010-08-17 Thread AK
On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: Hi Neil, On 2010-08-17 14:42, Neil Cerutti wrote: On 2010-08-17, Michael Torrie wrote: In general if I find myself consistently going longer than 75 or 80 characters, I need to refactor my code to make it more manageable. If I have to scroll up

Re: Opposite of split

2010-08-17 Thread Neil Cerutti
On 2010-08-17, Stefan Schwarzer wrote: > Hi Alex, > > On 2010-08-16 18:44, Alex van der Spek wrote: >> Anybody catches any other ways to improve my program (attached), you are >> most welcome. Help me learn, that is one of the objectives of this >> newsgroup, right? Or is it all about exchanging

Re: 79 chars or more?

2010-08-17 Thread Neil Cerutti
On 2010-08-17, Stefan Schwarzer wrote: > Hi Neil, > > On 2010-08-17 14:42, Neil Cerutti wrote: >> Looking through my code, the split-up lines almost always >> include string literals or elimination of meaningless >> temporary variables, e.g.: >> >> self.expiration_date = translate_date(fi

Re: Python "why" questions

2010-08-17 Thread Robert Kern
On 8/16/10 11:10 PM, Steven D'Aprano wrote: On Mon, 16 Aug 2010 22:56:20 -0500, Robert Kern wrote: On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: In message, Roy Smith wrote: 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? a) 299

Podcast about Python's versions and implementations

2010-08-17 Thread Ron
New podcast up is a look at the various versions and implementations of Python, including Python 3, Python 2, PyPy, IronPython, Jython, Stackless, Psycho, Shedskin, Cython, Unladen Swallow, Berp, etc. http://www.awaretek.com/python/ Ron -- http://mail.python.org/mailman/listinfo/python-list

scrapelib for web scraping

2010-08-17 Thread Ron
Shameless plug for a web scraping tool my son is involved in creating, called scrapelib. He is on leave from university and is a consultant for the Sunlight Foundation creating something called the Fifty States Project to monitor lobbyist money to state governments in the USA. http://github.com/mi

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
Hi Neil, On 2010-08-17 14:42, Neil Cerutti wrote: > On 2010-08-17, Michael Torrie wrote: >> In general if I find myself consistently going longer than 75 >> or 80 characters, I need to refactor my code to make it more >> manageable. If I have to scroll up five pages to find the >> beginning of a

Python for MultiTouch!

2010-08-17 Thread Ron
Along with the news of Unbuntu supporting multitouch, I saw this and just had to share, I think its really nice: PyMT http://the-space-station.com/2010/8/16/python-multitouch:-pymt-0-5-released -- http://mail.python.org/mailman/listinfo/python-list

Re: Opposite of split

2010-08-17 Thread Stefan Schwarzer
Hi Alex, On 2010-08-16 18:44, Alex van der Spek wrote: > Anybody catches any other ways to improve my program (attached), you are > most welcome. Help me learn, that is one of the objectives of this > newsgroup, right? Or is it all about exchanging the next to impossible > solution to the never

Re: 79 chars or more?

2010-08-17 Thread Martin Gregorie
On Tue, 17 Aug 2010 13:00:51 +1000, James Mills wrote: > Roy, under normal circumstances I would agree with you and have a > different opinion. However being vision impaired restricts the available > width (irregardless of the width of the monitor) of text I'm able to > view at once. > I'm with Ja

Re: Python "why" questions

2010-08-17 Thread Lie Ryan
On 08/16/10 21:54, David Cournapeau wrote: > On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing > wrote: >>> On Aug 7, 2010, at 9:14 PM, John Nagle wrote: >>> The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That refl

Re: 79 chars or more?

2010-08-17 Thread Roy Smith
In article , Lawrence D'Oliveiro wrote: > In message , AK wrote: > > > As monitors are getting bigger, is there a general change in opinion on > > the 79 chars limit in source files? > > WHAT 79-character limit in source files? > > I currently have my Emacs windows set at 100 characters wide,

Re: 79 chars or more?

2010-08-17 Thread Neil Cerutti
On 2010-08-17, Michael Torrie wrote: > In general if I find myself consistently going longer than 75 > or 80 characters, I need to refactor my code to make it more > manageable. If I have to scroll up five pages to find the > beginning of a block, that normally means my code could be > simplified

Re: update of elements in GUI

2010-08-17 Thread Eric Brunel
(Top-post corrected; please don't do that, it makes messages very hard to read via usenetŠ) In article <26c363c8-11d7-49b9-a1c1-251ab5ff9...@p22g2000pre.googlegroups.com>, Jah_Alarm wrote: > On Aug 17, 7:19 pm, Eric Brunel > wrote: > > You have to call update_idletasks on a Tkinter *widget*,

Re: update of elements in GUI

2010-08-17 Thread Jah_Alarm
In MATLAB this command is drawnow, just in case On Aug 17, 9:49 pm, Jah_Alarm wrote: > thanks. The thing is, the objects actually get updated without this > command, but when I run the GUI outside of python shell (i.e. in > command prompt as python filename.py or compile it to .exe file) the > ob

Re: message box in Tkinter

2010-08-17 Thread Eric Brunel
In article <61cbd1cb-bd6d-49aa-818f-d28c46098...@x18g2000pro.googlegroups.com>, Jah_Alarm wrote: > I need to display a message box at the click of a button. I od the > following: > > from Tkinter import * > > def msg1(): > messagebox.showinfo(message='Have a good day') > > > Button(main

Re: message box in Tkinter

2010-08-17 Thread Matt Saxton
On Tue, 17 Aug 2010 04:02:23 -0700 (PDT) Jah_Alarm wrote: > > When I try importing messagebox from Tkinter i get an error message > that this module doesn't exist. > I believe what you want is Tkinter.Message -- Matt Saxton -- http://mail.python.org/mailman/listinfo/python-list

message box in Tkinter

2010-08-17 Thread Jah_Alarm
I need to display a message box at the click of a button. I od the following: from Tkinter import * def msg1(): messagebox.showinfo(message='Have a good day') Button(mainframe,text="About",command=msg1()).grid(column=360,row=36,sticky=W) I get the error msg 'global name 'messagebox' is not

Re: 79 chars or more?

2010-08-17 Thread BartC
"James Mills" wrote in message news:mailman..1282019212.1673.python-l...@python.org... On Tue, Aug 17, 2010 at 2:12 PM, AK wrote: There's no doubt that there are pro's and con's, but to be fair, it's not like code becomes unreadable over 79 chars - the difference is that when your termi

Re: passing variables as object attributes

2010-08-17 Thread Bruno Desthuilliers
Vikas Mahajan a écrit : On 16 August 2010 19:23, Nitin Pawar wrote: you would need to define a class first with its attiributes and then you may want to initiate the variables by calling the class initilializer Actually I have to dynamically add attributes to a object. I am writing python scr

EARN 10$ PER ADVERTISEMENT OF 60 SEC

2010-08-17 Thread tania tani
MESSAGE NO 1 FOR YOU READ IT. http://www.fineptc.com/index.php?ref=imranraza460 Hello my dear friend, I hope you will be fine. i want to tell you the authentic way to make money wi

Re: update of elements in GUI

2010-08-17 Thread Jah_Alarm
thanks. The thing is, the objects actually get updated without this command, but when I run the GUI outside of python shell (i.e. in command prompt as python filename.py or compile it to .exe file) the objects do not get updated. I tried Label(mainframe,textvariable=var).grid(column=1,row=1).update

Re: 2 Regex Questions

2010-08-17 Thread AlphaBravo
On Aug 17, 10:23 am, Peter Otten <__pete...@web.de> wrote: > AlphaBravo wrote: > >  2) How can I split a string into sections that MATCH a regex (rather > > then splitting by seperator). Tokenizer-style but ignoring every place > > from where I can't start a match? > >>> import re > >>> re.compile(

Re: Simple Python Sandbox

2010-08-17 Thread Roland Koebler
On Sat, Aug 14, 2010 at 08:01:00PM -0700, Stephen Hansen wrote: > > As you can see, black listing isn't the best approach here. > > But I have a two pronged strategy: the black list is only half of the > equation. One, I'm blacklisting all the meta functions out of builtins. But blacklists are *ne

Re: 79 chars or more?

2010-08-17 Thread Jean-Michel Pichavant
Michele Simionato wrote: On Aug 17, 6:50 am, AK wrote: On 08/17/2010 12:26 AM, James Mills wrote: By the way, the reason I asked is that we're working on a python tutorial and I realized that even though I'm used to 99, I wasn't sure if it's ok to teach that to new users or not.. -andrei

Re: segfault with small pyqt script

2010-08-17 Thread Hans-Peter Jansen
On Monday 16 August 2010, 09:22:27 Gelonida wrote: > Hi Hans-Peter, > > > It seems, that my other posts did not get through. > > On 08/15/2010 11:17 PM, Hans-Peter Jansen wrote: > > For a starter, tell us the versions of python-sip, and python-qt4 or > > however they're called in Ubuntu. For the re

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-17 Thread Giacomo Boffi
Paul Rubin writes: > Baba writes: >> exercise: given that packs of McNuggets can only be bought in 6, 9 or >> 20 packs, write an exhaustive search to find the largest number of >> McNuggets that cannot be bought in exact quantity. > > Is that a homework problem? yes, and no it was a homework p

Re: 79 chars or more?

2010-08-17 Thread Michele Simionato
On Aug 17, 6:50 am, AK wrote: > On 08/17/2010 12:26 AM, James Mills wrote: > By the way, the reason I asked is that we're working on a python > tutorial and I realized that even though I'm used to 99, I wasn't sure > if it's ok to teach that to new users or not.. > >    -andrei It is certainly NO

Re: 79 chars or more?

2010-08-17 Thread Lawrence D'Oliveiro
In message , AK wrote: > As monitors are getting bigger, is there a general change in opinion on > the 79 chars limit in source files? WHAT 79-character limit in source files? I currently have my Emacs windows set at 100 characters wide, and I’m thinking of going wider. Remember, the old hardc

Re: 2 Regex Questions

2010-08-17 Thread Peter Otten
AlphaBravo wrote: > 2) How can I split a string into sections that MATCH a regex (rather > then splitting by seperator). Tokenizer-style but ignoring every place > from where I can't start a match? >>> import re >>> re.compile("[abc]+").findall("abcxaaa! abba") ['abc', 'aaa', 'abba'] -- http:/

Re: Textvariable display in label (GUI design)

2010-08-17 Thread Eric Brunel
In article , Jah_Alarm wrote: > On Aug 17, 3:32 am, Eric Brunel > wrote: > > In article > > <993d9560-564d-47f0-b2db-6f0c6404a...@g6g2000pro.googlegroups.com>, > > > >  Jah_Alarm wrote: > > > hi, > > > > > pls help me out with the following issue: I wrote a function that uses > > > a for lo

Re: update of elements in GUI

2010-08-17 Thread Eric Brunel
In article <24dc97b3-a8b5-4638-9cf5-a397f1eae...@q16g2000prf.googlegroups.com>, Jah_Alarm wrote: > hi, I've already asked this question but so far the progress has been > small. > > I'm running Tkinter. I have some elements on the screen (Labels, most > importantly) which content has to be upd