Re: How to check if Pexpect child already exist?

2012-12-05 Thread Dave Angel
On 12/05/2012 02:41 AM, Thomas Elsgaard wrote: > Hi List > > I am wondering, how can i check if child already exist before i spawn > ? By definition, before you call the spawn, the child doesn't exist. So presumably you must mean something else. > child.isalive() cannot be done on child before

ANN: eGenix pyOpenSSL Distribution 0.13.0-1.0.1c

2012-12-05 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.13.0-1.0.1c An easy-to-install and easy-to-use distribution of the pyOpenSSL Python interface for

Re: ANN: eGenix mx Base Distribution 3.2.5 (mxDateTime, mxTextTools, etc.)

2012-12-05 Thread M.-A. Lemburg
On 01.12.2012 21:12, Piet van Oostrum wrote: > "M.-A. Lemburg" writes: > >> >> >> ANNOUNCING >> >>eGenix.com mx Base Distribution >> >> Version 3.2.5 for Python 2.4 - 2.7 >> >>

pydoc links prepend a domain

2012-12-05 Thread Gnarlodious
The pydoc.html.docmodule sends a page with clickable links relative to the script location. Is there a way to tell pydoc to prepend a string to those URLs? -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Nick Mellor wrote: > Hi Terry, > > For my money, and especially in your versions, despite several > expert solutions using other features, itertools has it. It > seems to me to need less nutting out than the other approaches. > It's short, robust, has a minimum of symbols, uses simp

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Chris Angelico
On Wed, Dec 5, 2012 at 12:17 PM, Nick Mellor wrote: > > takewhile mines for gold at the start of a sequence, dropwhile drops the > dross at the start of a sequence. When you're using both over the same sequence and with the same condition, it seems odd that you need to iterate over it twice. Per

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 12:17 PM, Nick Mellor wrote: >> >> takewhile mines for gold at the start of a sequence, dropwhile >> drops the dross at the start of a sequence. > > When you're using both over the same sequence and with the same > condition, it seems

http://docs.python.org/2.7/tutorial/index.html

2012-12-05 Thread EAGLE001101
-- http://mail.python.org/mailman/listinfo/python-list

Re: using smtp sent large file upto 60MB

2012-12-05 Thread Michael Torrie
On 12/04/2012 05:54 PM, moonhkt wrote: > Our SMTP can send file more than 60MB. But our notes server can > configured 100MB,30MB or 10MB. My notes Mail box can receive 100MB. > > In UNIX, by below command send smtp mail. > uuencode $xfn $xfn | mail -s "$SUBJECT" $NAME Just continue to use this s

Re: problem with usbtmc-communication

2012-12-05 Thread wrw
On Dec 4, 2012, at 11:12 AM, Jean Dubois wrote: > On 4 dec, 15:33, w...@mac.com wrote: >> On Dec 4, 2012, at 7:14 AM, Jean Dubois wrote: >> >> >> >>> The following test program which tries to communicate with a Keithley >>> 2200 programmable power supply using usbtmc in Python does not work a

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 7:34 AM, Neil Cerutti wrote: > Well, shoot! Then this is a job for groupby, not takewhile. The problem with groupby is that you can't just limit it to two groups. >>> prod_desc("CAPSICUM RED fresh from QLD") ['QLD', 'fresh from'] Once you've got a false key from the group

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Mark Lawrence
On 05/12/2012 13:45, Chris Angelico wrote: I tested it on Python 3.2 (yeah, time I upgraded, I know). Bad move, fancy wanting to go to the completely useless version of Python that simply can't handle unicode properly :) -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo

Re: http://docs.python.org/2.7/tutorial/index.html

2012-12-05 Thread Mark Lawrence
On 05/12/2012 14:54, EAGLE001101 wrote: Well speaking personally I'm convinced that the majority of wrong thinking people in this country are right, and I'm sick and tired of being told that they're not. An alternative is that you wanted some data regarding the Python tutorial, but dear o

why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
Hi, I'm interested in compilers optimizations, so I study python compilation process I ran that script: import timeit def f(x): return None def g(x): return None print(x) number = 1 print(timeit.timeit('f(1)',setup="from __main__ import f", num

Software Developer NEEDED! Morrisville, NC

2012-12-05 Thread Whitney Holman
PYTHON DEVELOPER NEEDED - EXCITING OPPORTUNITY IN MORRISVILLE, NC The Select Group is seeking a Python software engineer for fun, energetic, and growing company in Morrisville, NC. The ideal candidate will have hands-on development experience, and must have working knowledge of Python. A very

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Ian Kelly wrote: > On Wed, Dec 5, 2012 at 7:34 AM, Neil Cerutti wrote: >> Well, shoot! Then this is a job for groupby, not takewhile. > > The problem with groupby is that you can't just limit it to two groups. > prod_desc("CAPSICUM RED fresh from QLD") > ['QLD', 'fresh from']

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 6:45 AM, Chris Angelico wrote: > On Wed, Dec 5, 2012 at 12:17 PM, Nick Mellor wrote: >> >> takewhile mines for gold at the start of a sequence, dropwhile drops the >> dross at the start of a sequence. > > When you're using both over the same sequence and with the same > co

Re: why does dead code costs time?

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Bruno Dupuis wrote: > Hi, > > I'm interested in compilers optimizations, so I study python > compilation process > > I ran that script: > > import timeit > > def f(x): > return None > > def g(x): > return None > print(x) > > number = 1 > >

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: > On 2012-12-05, Bruno Dupuis wrote: > > Hi, > > > > I'm interested in compilers optimizations, so I study python > > compilation process > > > > I ran that script: > > > > import timeit > > > > def f(x): > > return None

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Nick Mellor
Hi Neil, Here's some sample data. The live data is about 300 minor variations on the sample data, about 20,000 lines. Nick Notes: 1. Whitespace is only used for word boundaries. Surplus whitespace is not significant and can be stripped 2. Retain punctuation and parentheses 3. Product is zer

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 05:40:51PM +0100, Bruno Dupuis wrote: > On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: > > Maybe it's the difference between LOAD_CONST and LOAD_GLOBAL. We > > can wonder why g uses the latter. > > Good point! I didn't even noticed that. It's weird... Maybe t

Re: why does dead code costs time?

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 16:46:39 +0100, Bruno Dupuis wrote: > Hi, > > I'm interested in compilers optimizations, so I study python compilation > process > > I ran that script: > > import timeit > > def f(x): > return None > > def g(x): > return None > print(x)

Re: How does one make argparse print usage when no options are provided on the command line?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 08:48:30AM -0800, rh wrote: > I have argparse working with one exception. I wanted the program to print out > usage when no command line options are given. But I only came across > other examples where people didn't use argparse but instead printed out > a separate usage sta

Re: why does dead code costs time?

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 17:34:57 +, Steven D'Aprano wrote: > I believe that's a leftover from > early Python days when None was not a keyword and could be reassigned. Oops! Wrong copy and paste! Here's a simpler version: [steve@ando ~]$ python1.5 Python 1.5.2 (#1, Aug 27 2012, 09:09:18) [GCC 4.

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread MRAB
On 2012-12-05 17:04, Nick Mellor wrote: Hi Neil, Here's some sample data. The live data is about 300 minor variations on the sample data, about 20,000 lines. [snip] You have a duplicate: CELERY Mornington Peninsula IPM grower CELERY Mornington Peninsula IPM grower -- http://mail.python.or

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread MRAB
On 2012-12-05 13:45, Chris Angelico wrote: On Wed, Dec 5, 2012 at 12:17 PM, Nick Mellor wrote: takewhile mines for gold at the start of a sequence, dropwhile drops the dross at the start of a sequence. When you're using both over the same sequence and with the same condition, it seems odd t

Re: why does dead code costs time?

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano wrote: > The difference is almost certain between the LOAD_CONST and the > LOAD_GLOBAL. > > As to *why* there is such a difference, I believe that's a leftover from > early Python days when None was not a keyword and could be reassigned. I think th

Help "joining" two files delimited with pipe character ("|")

2012-12-05 Thread Daniel Doo
Hello, I am new to Python. Is there a method to "join" two pipe delimited files using a unique key that appears in both files? I would like to implement something similar to the Unix join command. Thanks for your help! Topeka Capital Markets Disclaimers - ht

Re: Help "joining" two files delimited with pipe character ("|")

2012-12-05 Thread Miki Tebeka
On Wednesday, December 5, 2012 9:57:31 AM UTC-8, Daniel Doo wrote: > I am new to Python.  Is there a method to “join” two pipe delimited files > using a unique key that appears in both files?  Have a look at Panda's concat (http://pandas.pydata.org/pandas-docs/dev/merging.html). It also have util

Re: Help "joining" two files delimited with pipe character ("|")

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 11:18 AM, Ian Kelly wrote: > On Wed, Dec 5, 2012 at 10:57 AM, Daniel Doo > wrote: >> I am new to Python. Is there a method to “join” two pipe delimited files >> using a unique key that appears in both files? I would like to implement >> something similar to the Unix join

Re: Help "joining" two files delimited with pipe character ("|")

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 10:57 AM, Daniel Doo wrote: > I am new to Python. Is there a method to “join” two pipe delimited files > using a unique key that appears in both files? I would like to implement > something similar to the Unix join command. If the files are small enough to fit in virtual

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: > On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano > wrote: > > The difference is almost certain between the LOAD_CONST and the > > LOAD_GLOBAL. > > > > As to *why* there is such a difference, I believe that's a leftover from > > early Pyt

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Nick Mellor wrote: > Hi Neil, > > Here's some sample data. The live data is about 300 minor > variations on the sample data, about 20,000 lines. Thanks, Nick. This slight variation on my first groupby try seems to work for the test data. def prod_desc(s): prod = [] desc =

Re: How does one make argparse print usage when no options are provided on the command line?

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 9:48 AM, rh wrote: > I have argparse working with one exception. I wanted the program to print out > usage when no command line options are given. But I only came across > other examples where people didn't use argparse but instead printed out > a separate usage statement. S

Need porting of German Wotan AI into Python

2012-12-05 Thread Mentifex
The Artificial General Intelligence (AGI) at http://www.scn.org/~mentifex/mindforth.txt has been re-recreated in the German language at http://www.scn.org/~mentifex/DeKi.txt and needs porting into the Python language. There are no funds available for payment but mega kudos will accrue to the s

Secretly passing parameter to function

2012-12-05 Thread Olivier Scalbert
Hi all ! I have a problem that is not easy to explained, so I have tried to reduce it a lot. We are using a framework, that we can not modify. in framework.py: def do(something): ''' Here we are in a framework that can not be modified ... It does a lot of things and finally: '

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Nick Mellor
Neil, Further down the data, found another edge case: "Spring ONION from QLD" Following the spec, the whole line should be description (description starts at first word that is not all caps.) This case breaks the latest groupby. N -- http://mail.python.org/mailman/listinfo/python-list

Remote server: running a Python script and making *.csv files publicly available

2012-12-05 Thread Jason Hsu
I have a Python 2.7 script that produces *.csv files. I'd like to run this Python script on a remote server and make the *.csv files publicly available to read. Can this be done on Heroku? I've gone through the tutorial, but it seems to be geared towards people who want to create a whole web

Re: Secretly passing parameter to function

2012-12-05 Thread Dave Angel
On 12/05/2012 01:50 PM, Olivier Scalbert wrote: > Hi all ! > > I have a problem that is not easy to explained, so I have tried to > reduce it a lot. > > We are using a framework, that we can not modify. > > in framework.py: > def do(something): >''' >Here we are in a framework that can not

Re: Secretly passing parameter to function

2012-12-05 Thread Chris Kaynor
On Wed, Dec 5, 2012 at 10:50 AM, Olivier Scalbert < olivier.scalb...@algosyn.com> wrote: > Hi all ! > > I have a problem that is not easy to explained, so I have tried to reduce > it a lot. > > We are using a framework, that we can not modify. > > in framework.py: > def do(something): >''' >

mini browser with python

2012-12-05 Thread inq1ltd
Python help. I can connect to and download a web page, html code, and save it to a file. If connected to the web, I can use KWrite to open the file and navigate the page. I want to view the html file without using a browser or KWrite as I do now. In other words I need a mini, simple browser

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Nick Mellor wrote: > Neil, > > Further down the data, found another edge case: > > "Spring ONION from QLD" > > Following the spec, the whole line should be description > (description starts at first word that is not all caps.) This > case breaks the latest groupby. A-ha! I did chec

Re: Python Noob Question.

2012-12-05 Thread Owatch
Re On Monday, December 3, 2012 4:19:51 PM UTC+2, Alexander Blinne wrote: > Hello, > > > > by having a quick look at their website i found a plugin for CoreTemp > > which acts as a server and can be asked for status information of the > > cpu. Now your task is really simple: write a little fun

Re: mini browser with python

2012-12-05 Thread David Hutto
I think this is the snippe that you want: david@david-desktop:~$ python Python 2.7.3 (default, Aug 1 2012, 05:16:07) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import urlliib >>> url_to_read = urllib.urlopen('http://hitwebdevelopment.com') >>>

Re: problem with usbtmc-communication

2012-12-05 Thread Jean Dubois
On 5 dec, 16:26, w...@mac.com wrote: > On Dec 4, 2012, at 11:12 AM, Jean Dubois wrote: > > > On 4 dec, 15:33, w...@mac.com wrote: > >> On Dec 4, 2012, at 7:14 AM, Jean Dubois wrote: > > >>> The following test program which tries to communicate with a Keithley > >>> 2200 programmable power supply

Re: why does dead code costs time?

2012-12-05 Thread Terry Reedy
On 12/5/2012 1:24 PM, Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano wrote: The difference is almost certain between the LOAD_CONST and the LOAD_GLOBAL. As to *why* there is such a difference, I believe that's a

Re: why does dead code costs time?

2012-12-05 Thread Chris Kaynor
On Wed, Dec 5, 2012 at 12:41 PM, Terry Reedy wrote: > On 12/5/2012 1:24 PM, Bruno Dupuis wrote: > >> On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: >>> >>> I think this should even be considered a bug, not just a missing >>> optimization. Consider: >>> >> >> This is definitely a bug

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 03:41:19PM -0500, Terry Reedy wrote: > On 12/5/2012 1:24 PM, Bruno Dupuis wrote: > >On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: > >>On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano > >> wrote: > >>>The difference is almost certain between the LOAD_CONST and th

Re: Remote server: running a Python script and making *.csv files publicly available

2012-12-05 Thread Miki Tebeka
On Wednesday, December 5, 2012 11:14:42 AM UTC-8, Jason Hsu wrote: > make the *.csv files publicly available to read. > Can this be done on Heroku? I've gone through the tutorial, but it seems to > be geared towards people who want to create a whole web site. See one option - http://stackoverfl

Re: mini browser with python

2012-12-05 Thread Miki Tebeka
> In other words I need a mini, simple browser; > something I can build that will open, read and > display a saved html file. If you want to view the "raw" HTML, use any editor. If you want to view the rendered HTML (like in a browser), you can point your favorite browser to a local file or use

Re: mini browser with python

2012-12-05 Thread Hans Mulder
On 5/12/12 20:36:04, inq1ltd wrote: > Python help. ?This is not a Python question. > I can connect to and download a web page, > html code, and save it to a file. If connected > to the web, I can use KWrite to open the file > and navigate the page. > I want to view the html file without

Re: mini browser with python

2012-12-05 Thread Grant Edwards
On 2012-12-05, Hans Mulder wrote: > On 5/12/12 20:36:04, inq1ltd wrote: >> Python help. > > ? This is not a Python question. It sounds to me lik he's asking about using Python to render HTML and display the result. Back when I used Scheme/Tk for knocking out quick GUI apps, there was an "HTML" w

Re: mini browser with python

2012-12-05 Thread inq1ltd
On Wednesday, December 05, 2012 03:36:04 PM David Hutto wrote: > I think this is the snippe that you want: > > david@david-desktop:~$ python > Python 2.7.3 (default, Aug 1 2012, 05:16:07) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > >>> i

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
I added a patch on the issue tracker. It solves the bug for short (<32700 bytes) functions ref : http://bugs.python.org/file28217/16619-1.patch -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: mini browser with python

2012-12-05 Thread Dave Angel
On 12/05/2012 04:19 PM, inq1ltd wrote: > > > I need to view the code as if > I were opening it with a browser. > > Now, I set KWrite to read the code just > as Firefox does. > I want to incorporate a mini browser > in a module to do the same. > > regards, > jimonlinux > > > You still haven't g

Re: mini browser with python

2012-12-05 Thread inq1ltd
On Wednesday, December 05, 2012 10:15:58 PM Hans Mulder wrote: > On 5/12/12 20:36:04, inq1ltd wrote: > > Python help. > > ?This is not a Python question. > > > I can connect to and download a web page, > > html code, and save it to a file. If connected > > to the web, I can use KWrite to

mini browser with python

2012-12-05 Thread inq1ltd
Python help. I can connect to and download a web page, html code, and save it to a file. If connected to the web, I can change the settings on KWrite to open the file and navigate the page, (just like a browser does). I want to view the html file without using a browser or KWrite as I do n

Re: problem with usbtmc-communication

2012-12-05 Thread wrw
On Dec 5, 2012, at 3:38 PM, Jean Dubois wrote: [byte] >> >> I note that in your Octave example you are reading characters rather than >> lines. It seems to me that you have two choices here, either do the >> equivalent in python or dig through the Keithley documentation to find the >> hex

urlopen in python3

2012-12-05 Thread Olive
In python2, I use this code: a=urllib.urlopen(something) In python2, this work if "something" is a regular file on the system as well as a remote URL. The 2to3 script convert this to urllib.request.urlopen. But it does not work anymore if "something" is just a file name. My aim is to let the us

Confused compare function :)

2012-12-05 Thread Anatoli Hristov
Hi all, I'm confused again with a compare update function. The problem is that my function does not work at all and I don't get it where it comes from. in my DB I have total of 754 products. when I run the function is says: Total updated: 754 Total not found with in the distributor: 747 I just do

RE: urlopen in python3

2012-12-05 Thread Nick Cash
> In python2, this work if "something" is a regular file on the system as > well as a remote URL. The 2to3 script convert this to > urllib.request.urlopen. But it does not work anymore if "something" > is just a file name. > > My aim is to let the user specify a "file" on the command line and have

Re: mini browser with python

2012-12-05 Thread John Gordon
In inq1ltd writes: > In other words I need a mini, simple browser; > something I can build that will open, read and > display a saved html or the connected url site. What will be the output of this mini browser? Plain text? Rendered graphics? An audible screen reader? Something else? Wh

z-buffer mlab

2012-12-05 Thread Jan Kurzawski
Hi Guys! I am plotting an object in mlab (isoSurface) and then I am adding 2 image_plane_widgets. Till now everything is ok but when I am changing the opacity of the object to lower than 1 it is suddenly appearing behind the planes? Why so? Is it dependant on the order of adding objects? But i

Installing packages on Mac OS X 10.7.5

2012-12-05 Thread John Dildy
Hello Everyone! I have python v2.7.1 and I am trying to install packages on the Mac OS X v10.7.5 I am trying to install: Distribute Nose virtualenv If anyone can help me that would be great John Dildy jdild...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Remote server: running a Python script and making *.csv files publicly available

2012-12-05 Thread Michael Torrie
On 12/05/2012 12:14 PM, Jason Hsu wrote: > I have a Python 2.7 script that produces *.csv files. I'd like to > run this Python script on a remote server and make the *.csv files > publicly available to read. > > Can this be done on Heroku? I've gone through the tutorial, but it > seems to be gea

Re: urlopen in python3

2012-12-05 Thread Olive
Nick Cash wrote: > > In python2, this work if "something" is a regular file on the > > system as well as a remote URL. The 2to3 script convert this to > > urllib.request.urlopen. But it does not work anymore if "something" > > is just a file name. > > > > My aim is to let the user specify a "file

Re: Installing packages on Mac OS X 10.7.5

2012-12-05 Thread Irmen de Jong
On 6-12-2012 0:12, John Dildy wrote: > Hello Everyone! > > I have python v2.7.1 and I am trying to install packages on the Mac OS X > v10.7.5 > > I am trying to install: > > Distribute > > Nose > > virtualenv > > If anyone can help me that would be great > > John Dildy > > jdild...@gmail.c

Re: Confused compare function :)

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 11:50:49PM +0100, Anatoli Hristov wrote: > I'm confused again with a compare update function. The problem is that > my function does not work at all and I don't get it where it comes > from. > > in my DB I have total of 754 products. when I run the function is says: > Total

Re: Confused compare function :)

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 23:50:49 +0100, Anatoli Hristov wrote: > def Change_price(): Misleading function name. What price does it change? > total = 0 > tnf = 0 "tnf"? Does that mean something? > for row in DB: # DB is mySQL DB, logically I get out > # 1 SKU and

Re: Confused compare function :)

2012-12-05 Thread Steven D'Aprano
On Thu, 06 Dec 2012 01:19:58 +0100, Bruno Dupuis wrote: > I tried, I swear I did try, I didn't understand the whole algorithm of > the function. However, in a first sight, I find it way to deeply nested. Yes! But basically, the code seems to run a pair of nested for-loops: for SKU in database:

Re: mini browser with python

2012-12-05 Thread Hans Mulder
On 5/12/12 22:44:21, inq1ltd wrote: > I can connect to and download a web page, > html code, and save it to a file. If connected > to the web, I can change the settings on KWrite > to open the file and navigate the page, > (just like a browser does). > I want to view the html file without using a

Re: Installing packages on Mac OS X 10.7.5

2012-12-05 Thread Hans Mulder
On 6/12/12 00:56:55, Irmen de Jong wrote: > On 6-12-2012 0:12, John Dildy wrote: >> I have python v2.7.1 and I am trying to install packages on the Mac OS X >> v10.7.5 >> I am trying to install: >> Distribute >> Nose >> virtualenv >> If anyone can help me that would be great > > Avoid changing st

Re: Secretly passing parameter to function

2012-12-05 Thread Modulok
> Hi all ! > > I have a problem that is not easy to explained, so I have tried to > reduce it a lot. > > We are using a framework, that we can not modify. > > in framework.py: > def do(something): > ''' > Here we are in a framework that can not be modified ... > It does a lot of things

Dict comprehension help

2012-12-05 Thread Joseph L. Casale
I get a list of dicts as output from a source I need to then extract various dicts out of. I can easily extract the dict of choice based on it containing a key with a certain value using list comp but I was hoping to use dict comp so the output was not contained within a list. reduce(lambda x,y:

Re: Need porting of German Wotan AI into Python

2012-12-05 Thread alex23
On 6 Dec, 04:38, Mentifex wrote: > There are no funds available for payment but > mega kudos will accrue I'm sure that'll keep my kids well fed. Not commenting on this link, just including it here for the interested: http://www.nothingisreal.com/mentifex_faq.html -- http://mail.python.org/mail

Re: Confused compare function :)

2012-12-05 Thread Rotwang
On 06/12/2012 00:19, Bruno Dupuis wrote: [...] Another advice: never ever except XXXError: pass at least log, or count, or warn, or anything, but don't pass. Really? I've used that kind of thing several times in my code. For example, there's a point where I have a list of strings and I

Re: Dict comprehension help

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 8:03 PM, Joseph L. Casale wrote: > I get a list of dicts as output from a source I need to then extract various > dicts > out of. I can easily extract the dict of choice based on it containing a key > with > a certain value using list comp but I was hoping to use dict comp

Re: Confused compare function :)

2012-12-05 Thread Steven D'Aprano
On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote: > On 06/12/2012 00:19, Bruno Dupuis wrote: >> [...] >> >> Another advice: never ever >> >> except XXXError: >> pass >> >> at least log, or count, or warn, or anything, but don't pass. > > Really? I've used that kind of thing several times in

RE: Dict comprehension help

2012-12-05 Thread Joseph L. Casale
> {k: v for d in my_list if d['key'] == value for (k, v) in d.items()} Ugh, had part of that backwards:) Nice! > However, since you say that all dicts have a unique value for > z['key'], you should never need to actually merge two dicts, correct? > In that case, why not just use a plain for loop

question about importing a package

2012-12-05 Thread Matt
I have a directory structure that looks like this: sample.py sub_one/ __init__.py # defines only the list__all__ = ['foo', 'bar'] foo.py # defines the function in_foo() bar.py # defines the function in_bar() In sample.py, I have this command at the

Re: How does one make argparse print usage when no options are provided on the command line?

2012-12-05 Thread Terry Reedy
On 12/5/2012 7:48 PM, rh wrote: On Wed, 5 Dec 2012 18:42:37 +0100 Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 08:48:30AM -0800, rh wrote: I have argparse working with one exception. I wanted the program to print out usage when no command line options are given. But I only came across other ex

Re: question about importing a package

2012-12-05 Thread Chris Angelico
On Thu, Dec 6, 2012 at 3:58 PM, Matt wrote: > I have about 30 modules in my package (foos and bars) and I don't want 30 > lines at the top of each file that uses this package. What am I doing wrong? Not necessarily wrong, but definitely something to query: WHY do you have thirty modules in your

Re: why does dead code costs time?

2012-12-05 Thread Tim Roberts
Bruno Dupuis wrote: >On Wed, Dec 05, 2012 at 05:40:51PM +0100, Bruno Dupuis wrote: > >> Good point! I didn't even noticed that. It's weird... Maybe the >> difference comes from a peehole optim on f which is not possible on g as >> g is to complex. > >Neil, you were right, thanks. I patched peeho

Re: question about importing a package

2012-12-05 Thread alex23
On 6 Dec, 14:58, Matt wrote: > I have a directory structure that looks like this: > > sample.py > sub_one/ >       __init__.py     # defines only the list    __all__ = ['foo', 'bar'] >       foo.py           # defines the function in_foo() >       bar.py           # defines the function in_bar() >

Re: question about importing a package

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 20:58:46 -0800, Matt wrote: > I have a directory structure that looks like this: > > sample.py > sub_one/ > __init__.py # defines only the list __all__ = ['foo', 'bar'] > foo.py # defines the function in_foo() > bar.py # defines the function in_bar()

Some help in refining this regex for CSV files

2012-12-05 Thread Oltmans
Hi guys, I've to deal with CSVs that look like following CSV (with one header and 3 legit rows where each legit row has 3 columns) Some info Date: 12/6/2012 Author: Some guy Total records: 100 header1, header2, header3 one, two, three one, "Python is great, so are other languages, isn't ?",