Re: Default paranmeter for packed values

2010-04-19 Thread Gregory Ewing
MRAB wrote: Xavier Ho wrote: def t(a, *b = (3, 4)): File input, 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

Operations on sparse matrices

2010-04-19 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: Usable street address parser in Python?

2010-04-19 Thread Paul McGuire
On Apr 17, 2:23 pm, John Nagle na...@animats.com 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

Re: Usable street address parser in Python?

2010-04-19 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

About the grammar

2010-04-19 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

help req debugging python and c together

2010-04-19 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

Re: About the grammar

2010-04-19 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 Indeed, I

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, then

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: 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 input,

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 mar...@v.loewis.de 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

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 stdin, line 1 SyntaxError: keyword can't be an

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 parul.pande...@gmail.com wrote: I am

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

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 end

Re: Incorrect scope of list comprehension variables

2010-04-19 Thread Duncan Booth
Dave Angel da...@ieee.org 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

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

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

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

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

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

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 what the

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 sanamsi...@hotmail.com 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.

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

2010-04-19 Thread Dotan Cohen
On 30 March 2010 18:40, gentlestone tibor.b...@hotmail.com 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

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

Re: default value in list comprehension

2010-04-19 Thread eb303
On Apr 19, 2:20 pm, AlienBaby matt.j.war...@gmail.com 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

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 AlienBaby
On Apr 19, 1:23 pm, eb303 eric.brunel.pragma...@gmail.com wrote: On Apr 19, 2:20 pm, AlienBaby matt.j.war...@gmail.com 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

[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_]*

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

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

[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: [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

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 bruno.42.desthuilli...@websiteburo.invalid 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

Re: default value in list comprehension

2010-04-19 Thread Bruno Desthuilliers
eb303 a écrit : On Apr 19, 2:20 pm, AlienBaby matt.j.war...@gmail.com 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,

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 sanamsi...@hotmail.com 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

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: [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_]*)|(__.*__))$) [...]

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

Re: ctypes return char array with null chars

2010-04-19 Thread Mark Tolonen
chris cannady booo...@gmail.com 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

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: [...] and with

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

2010-04-19 Thread J Kenneth King
Oltmans rolf.oltm...@gmail.com 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

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

2010-04-19 Thread Giacomo Boffi
Jean-Michel Pichavant jeanmic...@sequans.com 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

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

2010-04-19 Thread Giacomo Boffi
Giacomo Boffi giacomo.bo...@polimi.it 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

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

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 *

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

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

2010-04-19 Thread Jean-Michel Pichavant
Giacomo Boffi wrote: Jean-Michel Pichavant jeanmic...@sequans.com 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

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 =

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

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

Re: UnicodeEncodeError during repr()

2010-04-19 Thread gb345
In hqguja$t...@online.de Martin v. Loewis mar...@v.loewis.de 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__ ?

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: 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 the

Re: scipy error undefined symbol: lsame_

2010-04-19 Thread Joaquin Abian
On Apr 19, 7:15 pm, gerardob gberbeg...@gmail.com 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

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 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

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

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:

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: 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 is

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

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 still the

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 cont...@xavierho.com wrote: 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

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

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 c...@rebertia.com 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

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 cont...@xavierho.com wrote: On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert c...@rebertia.com 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

Re: unexpected output from difflib.SequenceMatcher

2010-04-19 Thread Vlastimil Brom
From: Vlastimil Brom vlastimil.b...@gmail.com 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

Re: cross-platform coloured text in terminal

2010-04-19 Thread Jonathan Hartley
On Apr 17, 11:52 am, Jonathan Hartley tart...@tartley.com wrote: On Apr 16, 5:59 pm, Lie Ryan lie.1...@gmail.com 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.

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: 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 knifeno...@gmail.com 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.

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 c...@rebertia.com wrote: On Mon, Apr 19, 2010 at 6:00 PM, knifenomad knifeno...@gmail.com wrote: i know it's not very hard to get that solution. just by implementing simple function like below.      def partition(target, predicate):                      

Re: UnicodeEncodeError during repr()

2010-04-19 Thread Dave Angel
gb345 wrote: In hqguja$t...@online.de Martin v. Loewis mar...@v.loewis.de 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?

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: 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

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 menghan...@gmail.com 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:

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 menghan...@gmail.com 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

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 osk@gmail.com wrote: On 4월20일, 오전10시16분, Chris Rebert c...@rebertia.com wrote: On Mon, Apr 19, 2010 at 6:00 PM, knifenomad knifeno...@gmail.com wrote: i know it's not very hard to get that solution. just by implementing simple function like below.

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

2010-04-19 Thread alex23
Cameron Simpson c...@zip.com.au 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 =

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

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

2010-04-19 Thread Cameron Simpson
On 19Apr2010 21:31, alex23 wuwe...@gmail.com wrote: | Cameron Simpson c...@zip.com.au 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 |

[issue8453] build_installer.py breaks bzip compilation

2010-04-19 Thread Martin v . Löwis
New submission from Martin v. Löwis mar...@v.loewis.de: The current build_installer fails to build dependencies, e.g. with gcc-4.0 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -o bzip2 bzip2.o -L. -lbz2 collect2: cannot find 'ld' collect2: cannot find 'ld' lipo: can't open

[issue8451] syslog.syslog('msg') logs message with ident python.

2010-04-19 Thread Sean Reifschneider
Changes by Sean Reifschneider j...@tummy.com: Added file: http://bugs.python.org/file16983/syslog-kwargs2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8451 ___

[issue6095] os.curdir as the default argument for os.listdir

2010-04-19 Thread Virgil Dupras
Virgil Dupras hs...@hardcoded.net added the comment: Here's another one. I hadn't realized that it was useless to target the 2.x codebase. So I re-worked this on py3k. The change is non-trivial, since the non-windows/non-os2 part of the code has significantly changed in 3k. This time, since

[issue8449] buildbot: test_dbm and test_dbm_ndbm

2010-04-19 Thread roundup-admin
failures To: python-bugs-list@python.org From: STINNER Victor rep...@bugs.python.org Date: Sun, 18 Apr 2010 23:17:46 + Precedence: bulk X-Roundup-Name: Python tracker X-Roundup-Loop: hello X-Roundup-Version: 1.4.10 Reply-To: Python tracker rep...@bugs.python.org Message-Id:

[issue8393] subprocess: support undecodable current working directory on POSIX OS

2010-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: It does not work on Windows: subprocess.Popen(c:/windows/notepad.exe, cwd=b'c:/temp') Traceback (most recent call last): File stdin, line 1, in module File D:\afa\python\py3k-1\lib\subprocess.py, line 681, in __init__

[issue5650] Obsolete RFCs should be removed from doc of urllib.urlparse

2010-04-19 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: The 'See also' in the documentation should also be updated: http://docs.python.org/dev/library/urlparse.html#urlparse.urldefrag -- nosy: +ezio.melotti priority: - normal status: closed - open versions: +Python 3.2 -Python 3.0

[issue8438] Codecs: surrogateescape error handler in Python 2.7

2010-04-19 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: STINNER Victor wrote: STINNER Victor victor.stin...@haypocalc.com added the comment: I think it would be best to backport the handler (even though it is not needed in Python 2.7), since it makes porting apps to 3.x easier.

[issue8438] Codecs: surrogateescape error handler in Python 2.7

2010-04-19 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I consider this an important missing backport for 2.7, since without this handler, the UTF-8 codecs in 2.7 and 3.x are incompatible and there's no other way to work around this other than to make use of the errorhandler conditionally

[issue8393] subprocess: support undecodable current working directory on POSIX OS

2010-04-19 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: And please add unit tests... I'm thinking on this. I plan to write tests for all my last changes about surrogates. -- ___ Python tracker rep...@bugs.python.org

[issue8394] ctypes.dlopen() doesn't support surrogates

2010-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: It does not work on Windows: ctypes.CDLL(b'kernel32') Traceback (most recent call last): File stdin, line 1, in module File D:\afa\python\py3k-1\lib\ctypes\__init__.py, line 350, in __init__ self._handle = _dlopen(self._name,

[issue8393] subprocess: support undecodable current working directory on POSIX OS

2010-04-19 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: It does not work on Windows I always consider Windows as a special case because Windows uses unicode internally. Byte string are converted quickly to unicode using the current locale. My patch was for UNIX/BSD which uses byte

[issue8394] ctypes.dlopen() doesn't support surrogates

2010-04-19 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: load_library() uses LoadLibraryW() which use a WCHAR*. To support bytes, we can use LoadLibraryA() and TCHAR*. -- ___ Python tracker rep...@bugs.python.org

[issue8438] Codecs: surrogateescape error handler in Python 2.7

2010-04-19 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Ezio Melotti wrote: Ezio Melotti ezio.melo...@gmail.com added the comment: I consider this an important missing backport for 2.7, since without this handler, the UTF-8 codecs in 2.7 and 3.x are incompatible and there's no other way to

[issue8393] subprocess: support undecodable current working directory on POSIX OS

2010-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: PEP 277 explicitly states that unicode strings should be passed to wide-character functions, whereas byte strings use standard functions. This is done in posixmodule.c, for example. The current locale is a moving thing. --

[issue8394] ctypes.dlopen() doesn't support surrogates

2010-04-19 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I only fixed UNIX/BSD versions of subprocess/ctypes.dlopen() because it's not possible to open some files with an undecodable filename. On Windows, the file system and Python3 use Unicode, and so there is no such corner case. On

[issue8394] ctypes.dlopen() doesn't support surrogates

2010-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: yes, except that TCHAR* depends on compilation settings (it resolves to wchar_t when UNICODE is #defined); simply use char*. -- ___ Python tracker rep...@bugs.python.org

[issue8453] build_installer.py breaks bzip compilation

2010-04-19 Thread Ned Deily
Ned Deily n...@acm.org added the comment: Odd, works for me on 10.4, 10.5, and 10.6 (but I have never tried running under buildbot, if that is what is happening here). For 10.4 with its most-recent Xcode installed: $ /usr/bin/ld -v Apple Computer, Inc. version cctools-622.9~2 $ /usr/bin/gcc

[issue8393] subprocess: support undecodable current working directory on POSIX OS

2010-04-19 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: PEP 277 explicitly states that unicode strings should be passed to wide-character functions, whereas byte strings use standard functions. This is done in posixmodule.c, for example. CreateProcessW takes a lot of arguments.

[issue8451] syslog.syslog('msg') logs message with ident python.

2010-04-19 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Some notes about the patch: - NEWS blurbs generally appear antichronologically, that is newest first :-) - you don't have to mention that The 3.2 changes mentioned above are included in 2.7 - the part of the PyArg_ParseTupleAndKeywords string

[issue8410] Fix emulated lock to be 'fair'

2010-04-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Also, _POSIX_SEMAPHORES must be defined to be greater than 200112L. If it isn't, then it isn't supported. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8410

  1   2   3   >