Re: Usable street address parser in Python?

2010-04-19 Thread Tim Roberts
John Nagle wrote: > > Unfortunately, now it won't run with the released >version of "pyparsing" (1.5.2, from April 2009), because it uses >"originalTextFor", a feature introduced since then. I worked around that, >but discovered that the new version is case-sensitive. Changed >"Keyword" to "Ca

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread John Yeung
On Apr 20, 1:23 am, Cameron Simpson wrote: > On 19Apr2010 21:31, alex23 wrote: > | Cameron Simpson wrote: > | >   If items(), keys(), values(), iteritems(), iterkeys(), and > | >   itervalues() are called with no intervening modifications to the > | >   dictionary, the lists will directly corres

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread Cameron Simpson
On 19Apr2010 21:31, alex23 wrote: | Cameron Simpson wrote: | >   If items(), keys(), values(), iteritems(), iterkeys(), and | >   itervalues() are called with no intervening modifications to the | >   dictionary, the lists will directly correspond. This allows the | >   creation of (value, key) p

Re: Usable street address parser in Python?

2010-04-19 Thread John Nagle
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 and street number for at lea

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread alex23
Cameron Simpson wrote: >   If items(), keys(), values(), iteritems(), iterkeys(), and >   itervalues() are called with no intervening modifications to the >   dictionary, the lists will directly correspond. This allows the >   creation of (value, key) pairs using zip(): pairs = zip(d.values(), >  

Re: any modules having a function to partition a list by predicate provided?

2010-04-19 Thread Krister Svanlund
On Tue, Apr 20, 2010 at 3:40 AM, segunai wrote: > On 4월20일, 오전10시16분, Chris Rebert wrote: >> On Mon, Apr 19, 2010 at 6:00 PM, knifenomad wrote: >> > i know it's not very hard to get that solution. >> > just by implementing simple function like below. >> >> > def partition(target, predicate)

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread alex23
On Apr 20, 1:03 pm, Menghan Zheng wrote: > Is it assured the following statement is always True? > If it is always True, in which version, python2.x or python3.x? I believe its an implementation detail and should not be relied on. If you need consistent ordering, use an OrderedDict[1] or sort() t

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread Cameron Simpson
On 20Apr2010 11:03, Menghan Zheng wrote: | Is it assured the following statement is always True? | If it is always True, in which version, python2.x or python3.x? | | >>> a = dict() | ... | >>> assert(a.values == [a[k] for k in a.keys()]) | --> ? It is always true. At this URL: http://docs.py

Re: "ssl" module doesn't validate that domain of certificate is correct

2010-04-19 Thread John Nagle
exar...@twistedmatrix.com wrote: On 05:49 pm, na...@animats.com wrote: exar...@twistedmatrix.com wrote: On 04:51 pm, na...@animats.com wrote: I'm converting some code from M2Crypto to the new "ssl" module, and I've found what looks like a security hole. The "ssl" module will validate the c

dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread Menghan Zheng
Hello! Is it assured the following statement is always True? If it is always True, in which version, python2.x or python3.x? >>> a = dict() ... >>> assert(a.values == [a[k] for k in a.keys()]) --> ? Menghan Zheng -- http://mail.python.org/mailman/listinfo/python-list

Re: UnicodeEncodeError during repr()

2010-04-19 Thread Dave Angel
gb345 wrote: In "Martin v. Loewis" writes: Do I need to do something especial to get repr to work strictly with unicode? Yes, you need to switch to Python 3 :-) Or should __repr__ *always* return bytes rather than unicode? In Python 2.x: yes.

Re: any modules having a function to partition a list by predicate provided?

2010-04-19 Thread segunai
On 4월20일, 오전10시16분, Chris Rebert wrote: > On Mon, Apr 19, 2010 at 6:00 PM, knifenomad wrote: > > i know it's not very hard to get that solution. > > just by implementing simple function like below. > > >      def partition(target, predicate): > >            """ > >            split a list into tw

Re: any modules having a function to partition a list by predicate provided?

2010-04-19 Thread Chris Rebert
On Mon, Apr 19, 2010 at 6:00 PM, knifenomad wrote: > i know it's not very hard to get that solution. > just by implementing simple function like below. > >      def partition(target, predicate): >            """ >            split a list into two partitions with a predicate > provided. >          

any modules having a function to partition a list by predicate provided?

2010-04-19 Thread knifenomad
i know it's not very hard to get that solution. just by implementing simple function like below. def partition(target, predicate): """ split a list into two partitions with a predicate provided. any better ideas? :) """ true = []

Re: cross-platform coloured text in terminal

2010-04-19 Thread Jonathan Hartley
On Apr 17, 11:52 am, Jonathan Hartley wrote: > On Apr 16, 5:59 pm, Lie Ryan wrote: > > > > > On 04/16/10 19:28, Jonathan Hartley wrote: > > > > I'm playing with ideas of what API to expose. My favourite one is to > > > simply embed ANSI codes in the stream to be printed. Then this will > > > work

Re: unexpected output from difflib.SequenceMatcher

2010-04-19 Thread Vlastimil Brom
From: Vlastimil Brom Date: 2010/4/16 Subject: unexpected output from difflib.SequenceMatcher ... Instead of just reporting the insertion and deletion of these single characters ... the output of the SequenceMatcher decides to delete a large part of the string in between the differences and to ins

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Chris Rebert
On Mon, Apr 19, 2010 at 3:41 PM, Xavier Ho wrote: > On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert wrote: >> Additionally, `self.x = int` might not do what you thought it does. It >> does *not* create a new instance variable of type 'int'. Instead, it >> literally assigns to a new instance variabl

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Xavier Ho
On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert wrote: > Additionally, `self.x = int` might not do what you thought it does. It > does *not* create a new instance variable of type 'int'. Instead, it > literally assigns to a new instance variable x the *function*† that > converts values into integer

ANN: Oktest 0.2.1 released - a new style testing library.

2010-04-19 Thread kwatch
Hi, I released Oktest 0.2.1. homepage: http://packages.python.org/Oktest/ download: http://pypi.python.org/pypi/Oktest/ repository: http://bitbucket.org/kwatch/oktest/ Oktest is a new-style testing library for Python. from oktest import ok ok (x) > 0 # same as assert_(

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Chris Rebert
On Mon, Apr 19, 2010 at 2:29 PM, Xavier Ho wrote: > On Tue, Apr 20, 2010 at 7:21 AM, Robert Somerville > wrote: >> >> class ctest(): >>   x = int >>   y = [1,2,3] > > Variables defined directly under the class are known as "static variables" > in many other languages. Here in Python it's called a

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Xavier Ho
On Tue, Apr 20, 2010 at 7:21 AM, Robert Somerville < rsomervi...@sjgeophysics.com> wrote: > class ctest(): > x = int > y = [1,2,3] > Variables defined directly under the class are known as "static variables" in many other languages. Here in Python it's called a class variable, but they're sti

problems creating and adding class instances to a list:

2010-04-19 Thread Robert Somerville
I am trying to create a list of consisting of multiple instances of the same class, The Problems i am having is that i seem to be accessing the same memory.. How should i solve this Python problem ? Here is some sample code demonstraing my problem (same memory) : from copy import copy as cp cl

Re: pyconfig.h

2010-04-19 Thread Martin v. Loewis
omnia neo wrote: > Hi All, > > I am working on porting python on vxworks and hence was updating the PC > \pyconfig.h file for configurng python. As I am reading the file and > updating manually I come across lot many preprocessor directives which > I dont understand e.g. HAVE_NICE etc. May be this

Re: "ssl" module doesn't validate that domain of certificate is correct

2010-04-19 Thread exarkun
On 05:49 pm, na...@animats.com wrote: exar...@twistedmatrix.com wrote: On 04:51 pm, na...@animats.com wrote: I'm converting some code from M2Crypto to the new "ssl" module, and I've found what looks like a security hole. The "ssl" module will validate the certificate chain, but it doesn't

Re: scipy error undefined symbol: lsame_

2010-04-19 Thread Robert Kern
On 4/19/10 12:15 PM, gerardob wrote: I installed scipy (and all the required libraries) and the following error appears when i tried run a simple example which uses the optimize package of scipy. I tried also numpy alone and it works ( at least for printing numpy.array([10,20,10])) error: Trac

Re: Operations on sparse matrices

2010-04-19 Thread Robert Kern
On 4/19/10 1:03 AM, pp wrote: 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

Re: "ssl" module doesn't validate that domain of certificate is correct

2010-04-19 Thread geremy condra
On Mon, Apr 19, 2010 at 1:49 PM, John Nagle wrote: > exar...@twistedmatrix.com wrote: >> >> On 04:51 pm, na...@animats.com wrote: >>> >>>   I'm converting some code from M2Crypto to the new "ssl" module, and >>> I've found what looks like a security hole.  The "ssl" module will >>> validate the ce

Re: scipy error undefined symbol: lsame_

2010-04-19 Thread Joaquin Abian
On Apr 19, 7:15 pm, gerardob wrote: > I installed scipy (and all the required libraries) and the following error > appears when i tried run a simple example which uses the optimize package of > scipy. I tried also numpy alone and it works ( at least for printing > numpy.array([10,20,10])) > > erro

Re: "ssl" module doesn't validate that domain of certificate is correct

2010-04-19 Thread John Nagle
exar...@twistedmatrix.com wrote: On 04:51 pm, na...@animats.com wrote: I'm converting some code from M2Crypto to the new "ssl" module, and I've found what looks like a security hole. The "ssl" module will validate the certificate chain, but it doesn't check that the certificate is valid for

scipy error undefined symbol: lsame_

2010-04-19 Thread gerardob
I installed scipy (and all the required libraries) and the following error appears when i tried run a simple example which uses the optimize package of scipy. I tried also numpy alone and it works ( at least for printing numpy.array([10,20,10])) error: Traceback (most recent call last): File

Re: UnicodeEncodeError during repr()

2010-04-19 Thread gb345
In "Martin v. Loewis" writes: >> Do I need to do something especial to get repr to work strictly >> with unicode? >Yes, you need to switch to Python 3 :-) >> Or should __repr__ *always* return bytes rather than unicode? >In Python 2.x: yes. >> What about __str__ ? >Likewise. >> If both of

Re: "ssl" module doesn't validate that domain of certificate is correct

2010-04-19 Thread exarkun
On 04:51 pm, na...@animats.com wrote: I'm converting some code from M2Crypto to the new "ssl" module, and I've found what looks like a security hole. The "ssl" module will validate the certificate chain, but it doesn't check that the certificate is valid for the domain. Here's the basic

Tkinter scrollbar background color doesn't work

2010-04-19 Thread KL
Tkinter scrollbar widget's "background" and "relief" options seem not work. The below is the codes I tried and the python/tk information: === ActivePython 2.6.4.8 (ActiveState Software Inc.) based on Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)] on w

"ssl" module doesn't validate that domain of certificate is correct

2010-04-19 Thread John Nagle
I'm converting some code from M2Crypto to the new "ssl" module, and I've found what looks like a security hole. The "ssl" module will validate the certificate chain, but it doesn't check that the certificate is valid for the domain. Here's the basic code: sk = socket.socket(socket

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Jean-Michel Pichavant
Giacomo Boffi wrote: Jean-Michel Pichavant writes: Giacomo Boffi wrote: i have this code def example(a): return lambda b: a+b+1 fun = example(10) k_1 = fun(7) ... and pylint tells me [...] C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 5: Invalid n

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

2010-04-19 Thread John Nagle
Antoine Pitrou wrote: Perhaps you are using the wrong parameters and looking for ca_certs instead: That's right. Thanks. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

PLEASE HELP--Button images refuse to show.

2010-04-19 Thread Barrett
I have been fighting the same bug for weeks now with zero success: I am trying to get images to come up on my buttons, but they are way too small. Regardless of whether I used my old Python 2.5.1 or now 2.6.5, the following code: '''Minesweeper.''' from Tkinter import * #from

Can this be done simpler ?

2010-04-19 Thread Stef Mientki
hello, I want to use Python to give users the possibility to analyze data and create their custom reports. So I want a very simple language definition for the user, like : - the script must be case-insensitive - "user-words" are automatically translated into function names - users strings, should

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Giacomo Boffi
Giacomo Boffi writes: >> However, given you example, you should not insert code execution at >> you module level, unless it's required only at the module import. I >> dont know what is your module > > module? this was not well specified in my OP, but i'd rather speak of > a "script" instead of a

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Giacomo Boffi
Jean-Michel Pichavant writes: > Giacomo Boffi wrote: >> i have this code >> >> def example(a): >> return lambda b: a+b+1 >> >> fun = example(10) >> k_1 = fun(7) >> ... >> >> and pylint tells me >> >> [...] >> C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) >> C: 5: In

Re: Can someone please make it more pythonic or better?

2010-04-19 Thread J Kenneth King
Oltmans writes: > Greetings Python superstars, > > I've a directory structure like following > > tests / > __init__.py > testfile.py > > testfile.py contains following code > > import unittest > > class Calculator(unittest.TestCase): > def test_add(self): > print 'just add

Re: class instance customization

2010-04-19 Thread Alexander
On 18.04.2010 13:23, Steven D'Aprano wrote: > 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: >> > [...] > >>

Re: ctypes return char array with null chars

2010-04-19 Thread Mark Tolonen
"chris cannady" wrote in message news:b103e85a-05d5-4195-a18f-bd143e9f5...@b33g2000yqc.googlegroups.com... Hi all, I am passing a ctypes struct byref to a dll. When I get the struct back, it looks like the char array in the struct was truncated at the first null char. It should be 192 bytes l

Is it better to extend a class, or do something repetitious in the main part of a program?

2010-04-19 Thread J
First, before I get farther, Is there a way for the logging module to natively handle lists and dict objects when logging? e.g. take this {'key1':'val1','key2':'val2'} and have it logged like this: INFO: key1: val1 INFO: key2: val2 If I pass the dict or list directly to the logger, it is logged

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Jean-Michel Pichavant
Giacomo Boffi wrote: i have this code def example(a): return lambda b: a+b+1 fun = example(10) k_1 = fun(7) ... and pylint tells me [...] C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 5: Invalid name "k_1" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) [...]

extra room in Paris in your are stuck at the airport

2010-04-19 Thread Jean Daniel
Hello, I live in Paris, my roommate and I would gladly host a poor soul blocked at the airport due to the ash cloud. See me for details, Cheers, PS: disambiguation: talking about real physical cloud here... :) -- http://mail.python.org/mailman/listinfo/python-list

Re: installing debug symbols

2010-04-19 Thread shaunak saha
Change PATH and LD_LIBRARY_PATH variable to use /usr/local instead of /usr 2010/4/19 sanam singh > Hi, > Thanks for your reply. well the problem is that for gfb you need a python > interpreter with debugging symbols, but unfortunately as i am using > ubuntu9.10 it has python2.6 without debuggin

Re: default value in list comprehension

2010-04-19 Thread Bruno Desthuilliers
eb303 a écrit : On Apr 19, 2:20 pm, AlienBaby wrote: Hi, just a quick one, Is it possible to achieve a default value in a list comprehension where the if-clause is false? Ie, something similar to: [ a for a in b if something(a) else 'default' ] the idea being that, rather than skip a value

Re: Write web apps in Python?

2010-04-19 Thread Bruno Desthuilliers
Gilles Ganault a écrit : On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers wrote: The PHP execution model (mostly based on CGI FWIW) tends to be a bit unpractical for non-trivial applications since you have to rebuild the whole world for each and any incoming request, while with a long-r

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Alexandre Fayolle
top level "variables" in real code are often constants and pylint tries to help you get rid of global variables. --- frmsrcurl: http://compgroups.net/comp.lang.python/-pylint-why-pylint-wants-only-capitals-identifiers -- http://mail.python.org/mailman/listinfo/python-list

[CfP] DLS'10

2010-04-19 Thread Pascal Costanza
Dynamic Languages Symposium 2010 October 18, 2010 Co-located with SPLASH (OOPSLA) 2010 In cooperation with ACM SIGPLAN John Ascuaga's Nugget, Reno/Tahoe, Nevada, USA http://www.dynamic-languages-symposium.org/dls-10/ * Call for papers * The 6th Dynamic Languages Symposium (DLS) at the

RE: installing debug symbols

2010-04-19 Thread sanam singh
Hi, Thanks for your reply. well the problem is that for gfb you need a python interpreter with debugging symbols, but unfortunately as i am using ubuntu9.10 it has python2.6 without debugging symbols. now there are two ways out of it.first is that if we could add debug symbols to pre installed

urllib2.urlopen taking way too much time

2010-04-19 Thread Phonethics Mobile Media
handler = urllib2.urlopen(req) is taking way too much time to retrieve the URL. The same code using sockets in PHP doesn't delay this long. I had 'Authorization':'Basic ' + base64.b64encode("username:password") in my header though. [ I didnt use HTTPPasswordMgr & HTTPPasswordMgrWithDefaultRealm bec

[pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Giacomo Boffi
i have this code def example(a): return lambda b: a+b+1 fun = example(10) k_1 = fun(7) ... and pylint tells me [...] C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 5: Invalid name "k_1" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) [...] afaict, [A-Z_][A-Z0-9_]

Re: default value in list comprehension

2010-04-19 Thread AlienBaby
On Apr 19, 1:23 pm, eb303 wrote: > On Apr 19, 2:20 pm, AlienBaby wrote: > > > > > > > Hi, > > > just a quick one, > > > Is it possible to achieve a default value in a list comprehension > > where the if-clause is false? > > > Ie, something similar to: > > > [ a for a in b if something(a) else 'de

Re: copy some files from IE temporary internet files

2010-04-19 Thread Tim Golden
On 19/04/2010 10:49, CHEN Guang wrote: Hi friends, I want to program Python to copy some video files (.flv) from the IE folder "temporary internet files", but os.listdir('C:\\Documents and Settings\\Administrator\\Local Settings\\Temporary Internet Files') seemed unable to find any video file

Re: default value in list comprehension

2010-04-19 Thread eb303
On Apr 19, 2:20 pm, AlienBaby wrote: > Hi, > > just a quick one, > > Is it possible to achieve a default value in a list comprehension > where the if-clause is false? > > Ie, something similar to: > > [ a for a in b if something(a) else 'default' ] > > the idea being that, rather than skip a value

default value in list comprehension

2010-04-19 Thread AlienBaby
Hi, just a quick one, Is it possible to achieve a default value in a list comprehension where the if-clause is false? Ie, something similar to: [ a for a in b if something(a) else 'default' ] the idea being that, rather than skip a value if the if-clause is false, to place a default value at t

Re: (a==b) ? 'Yes' : 'No'

2010-04-19 Thread Dotan Cohen
On 30 March 2010 18:40, gentlestone wrote: > Hi, how can I write the popular C/JAVA syntax in Python? > > Java example: >    return (a==b) ? 'Yes' : 'No' > > My first idea is: >    return ('No','Yes')[bool(a==b)] > > Is there a more elegant/common python expression for this? > I'm a little late t

Re: installing debug symbols

2010-04-19 Thread shaunak saha
Hi, You need to install the python debugging packages for your ubuntu version. I guess its "python-dbg" Regards, Shaunak 2010/4/19 sanam singh > hi, > i am using ubuntu 9.10. it comes with preinstalled python2.6 having no > debug symbols.How can i add debug symbols to it. Secondly i cant affo

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

2010-04-19 Thread Antoine Pitrou
Le Sun, 18 Apr 2010 22:37:30 -0700, John Nagle a écrit : > > The cert file is the same PEM file I use with M2Crypto, and it's derived > from Firefox's cert file. > > Why am I getting a "private key" related error? I'm not submitting a > keyfile, just a cert file. I'm not an expert but this is w

pyconfig.h

2010-04-19 Thread omnia neo
Hi All, I am working on porting python on vxworks and hence was updating the PC \pyconfig.h file for configurng python. As I am reading the file and updating manually I come across lot many preprocessor directives which I dont understand e.g. HAVE_NICE etc. May be this is standard nomenclature and

copy some files from IE temporary internet files

2010-04-19 Thread CHEN Guang
Hi friends, I want to program Python to copy some video files (.flv) from the IE folder "temporary internet files", but os.listdir('C:\\Documents and Settings\\Administrator\\Local Settings\\Temporary Internet Files') seemed unable to find any video file (although they really exist and can

Re: class instance customization

2010-04-19 Thread Jean-Michel Pichavant
Alexander wrote: On 17.04.2010 18:32, Steven D'Aprano wrote: On Sat, 17 Apr 2010 13:09:43 +0400, Alexander wrote: Hi, list. I've some nontrivial class implementation MyClass and its instance my: my = MyClass(args) MyClass uses in internals some variable which is not defined in My

Req. for feedback -- writings on error handling & cleanup (Py3)

2010-04-19 Thread Alf P. Steinbach
After at least 3 false starts on my programming introduction's chapter 3, and some good and bad feedback from this group[1], I finally think the present chapter 3 approach is Good (enough). So no, I haven't given up in this book project, even though 4 months to produce these chapter 3's first

ctypes return char array with null chars

2010-04-19 Thread chris cannady
Hi all, I am passing a ctypes struct byref to a dll. When I get the struct back, it looks like the char array in the struct was truncated at the first null char. It should be 192 bytes long, but I know the 3rd through 6th byte are null chars and the array was truncated right before byte 3. Is the

Re: Incorrect scope of list comprehension variables

2010-04-19 Thread Duncan Booth
Dave Angel wrote: > 2) In original C, and I think in C++, the lifetime of i lasted long > after the loop ended. > for (int i=0; i< limit; ++i) > { >z += i; > } > i is still valid after this curly brace > > In C99, and at least in later C++, the scope of i ends w

Re: help req debugging python and c together

2010-04-19 Thread CHEN Guang
>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 e

installing debug symbols

2010-04-19 Thread sanam singh
hi, i am using ubuntu 9.10. it comes with preinstalled python2.6 having no debug symbols.How can i add debug symbols to it. Secondly i cant afford to install a fresh python version using OPT=-g way. Please tell me how can i add symbols to existing python2.6. The error that i get in gdb when i a

Re: Operations on sparse matrices

2010-04-19 Thread pp
I tried csr_matrix.dot(A,N) where A and N are two sparse matrices. is it correct for multiplication of two sparse matrices ? I still do not now how to perform matrix inversion for a sparse matrix. Can anyone please help. Thanks!! On Apr 19, 12:03 am, pp wrote: > I am currently dealing with spa

Re: About the grammar

2010-04-19 Thread franck
> >     argument: ... | test '=' test > Where are you finding that? This comes from Python-2.6/Grammar/Grammar in the source distribution. > This tells you that keyword arguments cannot have keywords that aren't > identifiers: > > >>> sum(1=2) > >   File "", line 1 > SyntaxError: keyword can't be

Re: About the grammar

2010-04-19 Thread franck
Thank you for this very clear (and quick) explanation! :-) Cheers, Franck On 19 avr, 08:58, "Martin v. Loewis" wrote: > # The reason that keywords are test nodes instead of NAME is that using > # NAME results in an ambiguity. ast.c makes sure it's a NAME. > argument: test [comp_for] | test '='

Re: Default paranmeter for packed values

2010-04-19 Thread Terry Reedy
On 4/18/2010 7: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 test(a = 1, b = (2, 3)): ... print a, b ... >> test() 1 (2, 3) >> def t(a, *b = (3, 4)): File "

Re: About the grammar

2010-04-19 Thread Martin v. Loewis
> Does any one knows why the grammar is so coded? Any intuition? The 2.7 Grammar clarifies that: # The reason that keywords are test nodes instead of NAME is that using # NAME results in an ambiguity. ast.c makes sure it's a NAME. argument: test [comp_for] | test '=' test The ambiguity is this:

Re: UnicodeEncodeError during repr()

2010-04-19 Thread Martin v. Loewis
> Do I need to do something especial to get repr to work strictly > with unicode? Yes, you need to switch to Python 3 :-) > Or should __repr__ *always* return bytes rather than unicode? In Python 2.x: yes. > What about __str__ ? Likewise. > If both of these are supposed to return bytes, > the