Re: About the grammar

2010-04-18 Thread Steven D'Aprano
On Sun, 18 Apr 2010 23:29:44 -0700, franck wrote: > Dear all, > > I'm wondering why in Python's grammar, keyword arguments are specified > as: > > argument: ... | test '=' test Where are you finding that? > I would have expected something like > > argument: ... | NAME '=' test > >

help req debugging python and c together

2010-04-18 Thread sanam singh
Hi, I am working in gnuradio compiler. I need some help in debugging python and c together. By this i mean that i have written some blocks in c that are connected together using python. So i need to debug( breakpoints ect ) python such that when a specific c block is called at the back end (in

About the grammar

2010-04-18 Thread franck
Dear all, I'm wondering why in Python's grammar, keyword arguments are specified as: argument: ... | test '=' test I would have expected something like argument: ... | NAME '=' test Indeed, I cannot imagine a case where the keyword is something else than an identifier. Moreover, in the

Re: Usable street address parser in Python?

2010-04-18 Thread Stefan Behnel
John Nagle, 17.04.2010 21:23: Is there a usable street address parser available? What kind of street address are you talking about? Only US-American ones? Because street addresses are spelled differently all over the world. Some have house numbers, some use letters or a combination, some ha

Re: Usable street address parser in Python?

2010-04-18 Thread Paul McGuire
On Apr 17, 2:23 pm, John Nagle wrote: >    Is there a usable street address parser available?  There are some > bad ones out there, but nothing good that I've found other than commercial > products with large databases.  I don't need 100% accuracy, but I'd like > to be able to extract street name

Operations on sparse matrices

2010-04-18 Thread pp
I am currently dealing with sparse matrices and have doubts on whether we can use 1.) dot (for matrix multiplication) and inv (inverse) operations of numpy on sparse matrices of CSR format. I initially constructed my sparse matrix using COO format and then converted it to CSR format now I want to

Re: Default paranmeter for packed values

2010-04-18 Thread Gregory Ewing
MRAB wrote: Xavier Ho wrote: >> def t(a, *b = (3, 4)): File "", line 1 def t(a, *b = (3, 4)): ^ SyntaxError: invalid syntax What was the rationale behind this design? The concept of a default value for the * argument doesn't really apply, because there is always a val

paypal wholesale d&g shoes (paypal payment)

2010-04-18 Thread world-trade
paypal wholesale d&g shoes (paypal payment) ( http://www.jordanonline06.com/) paypal wholesale gucci shoes (paypal payment) ( http://www.jordanonline06.com/) paypal wholesale lv shoes (paypal payment) ( http://www.jordanonline06.com/) paypal wholesale NBA shoes (paypal payment) ( http://www.jordano

Python 2.6 SSL module: Fails on key file error, with Errno 336265225, without a key file.

2010-04-18 Thread John Nagle
I'm starting to convert from M2Crypto to Python 2.6's SSL module. So I tried a trivial test: import ssl import socket certs = "d:/projects/sitetruth/certificates/cacert.pem" sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssk = ssl.wrap_socket(sk, certfile=certs, cert_reqs=ssl.CERT_NON

Re: The ole Repetion != Concatination pitfall

2010-04-18 Thread Steven D'Aprano
On Sun, 18 Apr 2010 17:34:03 -0700, JChG wrote: > But I'll still whine anyway...I'm not seeing where list repetition is > particularly useful, except when you want independent objects, like my > initialization of sieve above. Or when the objects are immutable, like ints, strings or None. pre_a

Re: feature request for a wget -r like implementation in python3

2010-04-18 Thread gert
On Apr 17, 1:14 am, "Gabriel Genellina" wrote: > En Thu, 15 Apr 2010 16:37:37 -0300, gert escribió: > > > [a wget -r like implementation in python3] > > So I can make a recursive http download script > > What about calling wget itself? subprocess.call(['wget',...]) > The only dependency I would

Re: feature request for a wget -r like implementation in python3

2010-04-18 Thread gert
On Apr 16, 3:41 am, alex23 wrote: > On Apr 16, 5:37 am, gert wrote: > > > So I can make a recursive http download script > > My goal is a one click instruction to install and launch my > > projecthttp://code.google.com/p/appwsgi/ > > Here's Guido's take on wget: > >     import sys, urllib >    

UnicodeEncodeError during repr()

2010-04-18 Thread gb345
I'm getting a UnicodeEncodeError during a call to repr: Traceback (most recent call last): File "bug.py", line 142, in element = parser.parse(INPUT) File "bug.py", line 136, in parse ps = Parser.Parse(open(filename,'r').read(), 1) File "bug.py", line 97, in end_item r = rep

Re: How to read file during module import?

2010-04-18 Thread HigStar
On Apr 13, 4:03 am, "Gabriel Genellina" wrote: > En Sun, 11 Apr 2010 19:43:03 -0300,HigStar escribió: > > > I have had trouble with the __file__ attribute in the past, when using > > py2exe (i.e. on the windows platform) and using the bundle feature > > (which zips all files). > > Using os.path.re

Re: python wia and RegisterEvent

2010-04-18 Thread Roger Upole
gelonida wrote: ... > while True: > print "sleep" > time.sleep(10) > >When I plug / unplug a USB WIA device nothing shows up. > My C# implementation prints messages on wiaEventDeviceConnected / > wiaEventDeviceDisconnected events if I register them. > > What am I missing? You need to be pr

Re: Default paranmeter for packed values

2010-04-18 Thread alex23
Xavier Ho wrote: > I ran into a strange problem today: why does Python not allow default > paranmeters for packed arguments in a function def? >> >> def t(a, *b = (3, 4)): >   File "", line 1 >     def t(a, *b = (3, 4)): >                 ^ > SyntaxError: invalid syntax > What was the rationale b

The ole Repetion != Concatination pitfall

2010-04-18 Thread JChG
Well I started learning Python last week, and in my first experiment I got caught when I changed: sieve = [ {1:True} for x in range(r)] to sieve = [{1:True}] * r I was expecting it to be equivalent to sieve = [{1:True},{1:True},...] but instead it's t = [{1:True}]; sieve = [t,t,...] Okay, I see

Re: Default paranmeter for packed values

2010-04-18 Thread Xavier Ho
On Mon, Apr 19, 2010 at 9:46 AM, Chris Rebert wrote: > It doesn't really make sense to use * in such situations anyway, you > can just do the normal `z = (1,2,3)` But calling function(1.0, (0.0, 1.0, 0.0)) has been a big pet peeve of mine, and it looks extremely ugly and, imo, unpythonic. On M

Re: Default paranmeter for packed values

2010-04-18 Thread Stephen Hansen
On Sun, Apr 18, 2010 at 4:23 PM, Xavier Ho wrote: > G'day Pythoneers, > > I ran into a strange problem today: why does Python not allow default > paranmeters for packed arguments in a function def? > >>> def t(a, *b = (3, 4)): > File "", line 1 > def t(a, *b = (3, 4)): > ^ >

Re: Default paranmeter for packed values

2010-04-18 Thread Chris Rebert
On Sun, Apr 18, 2010 at 4:23 PM, Xavier Ho wrote: > I ran into a strange problem today: why does Python not allow default > paranmeters for packed arguments in a function def? > def test(a = 1, b = (2, 3)): > ... print a, b > ... test() > 1 (2, 3) > def t(a, *b = (3, 4)): >   Fi

Re: Default paranmeter for packed values

2010-04-18 Thread MRAB
Xavier Ho wrote: G'day Pythoneers, I ran into a strange problem today: why does Python not allow default paranmeters for packed arguments in a function def? >> def test(a = 1, b = (2, 3)): ... print a, b ... >> test() 1 (2, 3) >> def t(a, *b = (3, 4)): File "", line 1 def

Default paranmeter for packed values

2010-04-18 Thread Xavier Ho
G'day Pythoneers, I ran into a strange problem today: why does Python not allow default paranmeters for packed arguments in a function def? >>> def test(a = 1, b = (2, 3)): ... print a, b ... >>> test() 1 (2, 3) >>> def t(a, *b = (3, 4)): File "", line 1 def t(a, *b = (3, 4)):

Re: Firefox: all I get is XML page source code

2010-04-18 Thread MRAB
Gnarlodious wrote: Thanks for that, for some reason I assumed sys.stdout.buffer.write sent the http header but I was wrong. Even so, Firefox still refused to render prperly, but this works/: content-type: application/xhtml+xml; charset=utf-8\n\n Perhaps it's not so much that there's a problem

Re: getting a string as the return value from a system command

2010-04-18 Thread Robert Kern
On 2010-04-18 03:13 , TomF wrote: On 2010-04-16 12:06:13 -0700, Catherine Moroney said: Hello, I want to call a system command (such as uname) that returns a string, and then store that output in a string variable in my python program. What is the recommended/most-concise way of doing this?

Re: Firefox: all I get is XML page source code

2010-04-18 Thread Gnarlodious
Thanks for that, for some reason I assumed sys.stdout.buffer.write sent the http header but I was wrong. Even so, Firefox still refused to render prperly, but this works/: content-type: application/xhtml+xml; charset=utf-8\n\n -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: Usable street address parser in Python?

2010-04-18 Thread John Roth
On Apr 17, 1:23 pm, John Nagle wrote: >    Is there a usable street address parser available?  There are some > bad ones out there, but nothing good that I've found other than commercial > products with large databases.  I don't need 100% accuracy, but I'd like > to be able to extract street name

Firefox: all I get is XML page source code

2010-04-18 Thread Gnarlodious
Wit's end on this. I have a script outputting a stream with: sys.stdout.buffer.write(("""\n The script works normally in 2 browsers, but in Firefox all I see is source code. Also, running the script in iPhone from my server shows the same source code. Which is a little strange since iPhone and Sa

Re: Building a GUI Toolkit

2010-04-18 Thread Martin P. Hellwig
On 04/18/10 12:49, Tim Diels wrote: Hi I was thinking of writing a GUI toolkit from scratch using a basic '2D library'. I have already come across the Widget Construction Kit. My main question is: Could I build a GUI toolkit of reasonable performance with the Widget Construction Kit, would it s

Re: Nested list problem - please...

2010-04-18 Thread Andreas Waldenburger
On Sat, 17 Apr 2010 13:31:54 -0700 Chris Rebert wrote: > On Sat, Apr 17, 2010 at 12:40 PM, Martin Hvidberg > wrote: > > I have this code, it builds up a data structure of nested lists, > > and filling data in them. My problem is that it seems that one of > > the lists SA[1] is not a list of uniq

Building a GUI Toolkit

2010-04-18 Thread Tim Diels
Hi I was thinking of writing a GUI toolkit from scratch using a basic '2D library'. I have already come across the Widget Construction Kit. My main question is: Could I build a GUI toolkit of reasonable performance with the Widget Construction Kit, would it still feel more or less lightweigh

Re: email and unicode

2010-04-18 Thread Steven D'Aprano
On Sun, 18 Apr 2010 03:02:23 -0700, janwillem wrote: > How can you get the unicode file name into the replace string of line 35 > of the snippet: > replace = ReplaceString % dict(content_type=ct, >filename=fn, >params=

email and unicode

2010-04-18 Thread janwillem
I have a script that extracts attachments from all emails in a mbox (largely based on http://code.activestate.com/recipes/302086-strip-attachments-from-an-email-message/; thanks ActiveState). It works fine until it encounters an attachment with a unicode file name (Ukrainian in my case). I cannot

Re: class instance customization

2010-04-18 Thread Steven D'Aprano
On Sat, 17 Apr 2010 19:55:44 +0400, Alexander wrote: > Ok, I'll try to explain on the following example. Let's consider class > MyClass that holds one string and concatenate it with other not defined > in this class: [...] > and with working application: > > a = MyClass() > a.set('key1') > > b1

Re: getting a string as the return value from a system command

2010-04-18 Thread TomF
On 2010-04-16 12:06:13 -0700, Catherine Moroney said: Hello, I want to call a system command (such as uname) that returns a string, and then store that output in a string variable in my python program. What is the recommended/most-concise way of doing this? I could always create a temporary f

Call for Paper/Participation for Malaysia Open Source Conference 2010

2010-04-18 Thread darXness
Call for Paper/Participation for Malaysia Open Source Conference 2010 http://conf.oss.my/cfp.html “OSS Towards Malaysia As A Developed Country In 2020” Area of Interest Cloud Computing Computer Security Games development Mobile Computing Data Freedom Ham Radio With the theme "OSS Towards Malays

Re: My first project

2010-04-18 Thread Kushal Kumaran
On Sat, Apr 17, 2010 at 11:46 PM, Someone Something wrote: > no one cares? :( > > On Sat, Apr 17, 2010 at 8:41 AM, Someone Something > wrote: >> >> This is my first large-scale (sort of) project in python. It is still >> under daily development, but the core is pretty stable (although, I'm still

Re: Python 2.7b1 and argparse's version action

2010-04-18 Thread Martin v. Loewis
> What do you think? If you want something to happen, you need to bring this up on python-dev. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-18 Thread Tim Roberts
CM wrote: > >On Apr 16, 3:31 am, Tim Roberts wrote: >> >> Microsoft's intent is that you be able to distribute the non-debug runtimes >> with any applications built with Visual Studio.  They are evil, but not >> arbitrarily malicious. > >Just to be clear: are you saying that if one has Visual St