[ANN] pywebkit - python bindings for webkit DOM (alpha)

2010-10-07 Thread lkcl
From: l...@lkcl.net To: python-l...@python.org i've been kindly sponsored by http://www.samurai.com.br to create direct python bindings to webkit's DOM: http://www.gnu.org/software/pythonwebkit/ the significance of this project is that it makes python a peer of javascript when it comes to

Re: list parameter of a recursive function

2010-10-07 Thread Seebs
On 2010-10-07, TP tribulati...@paralleles.invalid wrote: Diez B. Roggisch wrote: A safer alternative for these cases is using tuples, because they are immutable. The problem with tuples is that it is not easy to modify them: This is probably the best post-and-response I've seen in the last

Re: mantissa and exponent in base 10

2010-10-07 Thread Ulrich Eckhardt
Steven D'Aprano wrote: I want the mantissa and decimal exponent of a float, in base 10: mantissa and exponent of 1.2345e7 = (1.2345, 7) (0.12345, 8) would also be acceptable. [...] Have I missed a built-in or math function somewhere? The integral, decimal exponent is just the

Re: suggestions please what should i watch for/guard against' in a file upload situation?

2010-10-07 Thread MRAB
On 06/10/2010 21:01, Martin Gregorie wrote: On Wed, 06 Oct 2010 09:02:21 -0700, geekbuntu wrote: in general, what are things i would want to 'watch for/guard against' in a file upload situation? i have my file upload working (in the self-made framework @ work without any concession for

Re: list parameter of a recursive function

2010-10-07 Thread Chris Rebert
On Wed, Oct 6, 2010 at 10:25 PM, TP tribulati...@paralleles.invalid wrote: Diez B. Roggisch wrote: Back to your example: your solution is perfectly fine, although a bit costly and more error-prone if you happen to forget to create a copy. A safer alternative for these cases is using tuples,

Re: list parameter of a recursive function

2010-10-07 Thread Diez B. Roggisch
TP tribulati...@paralleles.invalid writes: Diez B. Roggisch wrote: Back to your example: your solution is perfectly fine, although a bit costly and more error-prone if you happen to forget to create a copy. A safer alternative for these cases is using tuples, because they are immutable.

Re: mantissa and exponent in base 10

2010-10-07 Thread Robert Kern
On 10/6/10 5:54 PM, Steven D'Aprano wrote: I want the mantissa and decimal exponent of a float, in base 10: mantissa and exponent of 1.2345e7 = (1.2345, 7) (0.12345, 8) would also be acceptable. The math module has a frexp() function, but it produces a base-2 exponent:

Re: list parameter of a recursive function

2010-10-07 Thread Terry Reedy
On 10/6/2010 3:22 PM, TP wrote: Hi, I have a function f that calls itself recursively. It has a list as second argument, with default argument equal to None (and not [], as indicated at: http://www.ferg.org/projects/python_gotchas.html#contents_item_6 ) This sort of function is an exception.

Re: suggestions please what should i watch for/guard against' in a file upload situation?

2010-10-07 Thread Terry Reedy
On 10/6/2010 12:02 PM, geekbuntu wrote: in general, what are things i would want to 'watch for/guard against' in a file upload situation? i have my file upload working (in the self-made framework @ work without any concession for multipart form uploads), but was told to make sure it's cleansed

Re: hashkey/digest for a complex object

2010-10-07 Thread Terry Reedy
On 10/6/2010 2:58 PM, kj wrote: These objects are non-mutable once they are created, See below. like to use a two-step comparison for equality, based on the assumption that I can compute (either at creation time, or as needed and memoized) a hashkey/digest for each object. The test for

Re: help!!!

2010-10-07 Thread Emile van Sebille
On 10/6/2010 12:08 PM Diez B. Roggisch said... fkr...@aboutrafi.net23.net writes: plz can u convert this cpp file into python i need that badly as soon as possible... I am new to python. I just wanna learn it For such an aspiring student of the art of computer programming, I have the

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-07 Thread Terry Reedy
On 10/6/2010 7:14 AM, Antoon Pardon wrote: That right-hand-half-open intervals (i.e. a= i b, equivalently [a, b) ), which are what Python uses, are to be preferred. (See aforelinked PDF: http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF) This specifically discusses subsequences of

Opening a webpage in the background via webbrowser.open()

2010-10-07 Thread python
Python 2.7 (32-bit/Windows): Is there a way to use webbrowser.open() to open a web page in the default browser, but in the background, so that the application making the webbrowser.open() call remains the active application? Thank you, Malcolm --

ConFoo spam?

2010-10-07 Thread Chris Withers
Hi All, Is it just me or does the mailing of just about every single python-based project mailing list with a 90% form email advertising a conference that only has one python track *and* clashes with PyCon feel just a bit like spam? I know it's enough to put me off even considering going to

Re: 64 bit offsets?

2010-10-07 Thread jay thompson
As nice as it would be to use 64bit offsets I am instead mmapping the file in 1GB chunks and getting the results I need. I would still be interested in a 64bit solution though. jt On Wed, Oct 6, 2010 at 2:41 PM, jay thompson jayryan.thomp...@gmail.comwrote: Hello everyone, I'm trying to

64 bit offsets?

2010-10-07 Thread jay thompson
Hello everyone, I'm trying to extract some data from a large memory mapped file (the largest is ~30GB) with re.finditer() and re.start(). Pythons regular expression module is great but the size of re.start() is 32bits (signed so I can really only address 2GB). I was wondering if any here had

Re: list parameter of a recursive function

2010-10-07 Thread TP
Seebs wrote: On 2010-10-07, TP tribulati...@paralleles.invalid wrote: Diez B. Roggisch wrote: A safer alternative for these cases is using tuples, because they are immutable. The problem with tuples is that it is not easy to modify them: This is probably the best post-and-response I've

[ANN] pywebkit - python bindings for webkit DOM (alpha)

2010-10-07 Thread Luke Kenneth Casson Leighton
i've been kindly sponsored by http://www.samurai.com.br to create direct python bindings to webkit's DOM: http://www.gnu.org/software/pythonwebkit/ the significance of this project is that it makes python a peer of javascript when it comes to manipulating HTML through DOM functions (including

Re: mantissa and exponent in base 10

2010-10-07 Thread Jason Swails
On Wed, Oct 6, 2010 at 6:54 PM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: I want the mantissa and decimal exponent of a float, in base 10: mantissa and exponent of 1.2345e7 Perhaps not the prettiest, but you can always use string manipulations: def frexp_10(decimal):

no .pyc

2010-10-07 Thread Tim Hanson
I feel a little silly. I am learning Python by reading _Learning_Python_ by Mark Lutz. I made it all the way to Hello World before my first question. :-) The program isn't too complicated. print Hello World print 2**100 I saved it to a directory for which I have rw permissions that I moved

how to write an xml file without dom.ext?

2010-10-07 Thread hackingKK
Hello all. I need to create an xml file. I am using dom.minidom module. It works fine as long as the xml tree is created. But I get the import error for dom.ext. I searched through the python docs but can't find a solution. I am pritty sure that there is way to write the file to disk without

Re: no .pyc

2010-10-07 Thread News123
On 10/07/2010 11:55 AM, Tim Hanson wrote: I feel a little silly. I am learning Python by reading _Learning_Python_ by Mark Lutz. I made it all the way to Hello World before my first question. :-) The program isn't too complicated. print Hello World print 2**100 I saved it to a

Re: how to write an xml file without dom.ext?

2010-10-07 Thread Nitin Pawar
why not just convert it to string with print pretty and then normal write to a file On Thu, Oct 7, 2010 at 3:36 PM, hackingKK hackin...@gmail.com wrote: Hello all. I need to create an xml file. I am using dom.minidom module. It works fine as long as the xml tree is created. But I get the

Re: hashkey/digest for a complex object

2010-10-07 Thread kj
In mailman.1415.1286438617.29448.python-l...@python.org Terry Reedy tjre...@udel.edu writes: If these two attributes, and hence the dicts, are public, then your instances are mutable. I guess I should have written immutable among consenting adults. As far as I know, Python does not support

Re: how to write an xml file without dom.ext?

2010-10-07 Thread hackingKK
On Thursday 07 October 2010 03:49 PM, Nitin Pawar wrote: why not just convert it to string with print pretty and then normal write to a file Can you give an example. happy hacking. Krishnakant. On Thu, Oct 7, 2010 at 3:36 PM, hackingKK hackin...@gmail.com mailto:hackin...@gmail.com wrote:

Re: hashkey/digest for a complex object

2010-10-07 Thread kj
In m2fwwjazs2@web.de de...@web.de (Diez B. Roggisch) writes: kj no.em...@please.post writes: The short version of this question is: where can I find the algorithm used by the tuple class's __hash__ method? Surprisingly, in the source:

Re: how to write an xml file without dom.ext?

2010-10-07 Thread Nitin Pawar
import xml.dom.minidom import os xml = xml.dom.minidom.parse(xml_fname) # or xml.dom.minidom.parseString(xml_string) pretty_xml_as_string = xml.toprettyxml() file = open(newfile, 'w') file.write(pretty_xml_as_string) file.close() 1. On Thu, Oct 7, 2010 at 4:16 PM, hackingKK

Re: if the else short form

2010-10-07 Thread BartC
On Thu, 07 Oct 2010 01:36:33 +0100, BartC wrote: However, as I mentioned, one problem here is having to evaluate all the items in the list before selecting one: ... x = {1 : fna(), 2 : fnb(), 3 : fnc()}.get(i, None Of The Above) Mel mwil...@the-wire.com wrote in message

Re: mantissa and exponent in base 10

2010-10-07 Thread Dave Angel
On 2:59 PM, Steven D'Aprano wrote: I want the mantissa and decimal exponent of a float, in base 10: mantissa and exponent of 1.2345e7 = (1.2345, 7) (0.12345, 8) would also be acceptable. The math module has a frexp() function, but it produces a base-2 exponent: math.frexp(1.2345e7)

Re: SysLogHandler message formatting

2010-10-07 Thread Vinay Sajip
On Oct 6, 6:56 pm, Dustin C. Hatch admiraln...@gmail.com wrote: My question, therefore, is where does this problem lie? Is it a bug in Metalog that it doesn't properly parse the message, or is it a bug in SysLogHandler that it doesn't properly format it? I guess it could also be that if one

Re: how to write an xml file without dom.ext?

2010-10-07 Thread Diez B. Roggisch
hackingKK hackin...@gmail.com writes: Hello all. I need to create an xml file. I am using dom.minidom module. It works fine as long as the xml tree is created. But I get the import error for dom.ext. I searched through the python docs but can't find a solution. I am pritty sure that there

Re: ConFoo spam?

2010-10-07 Thread Diez B. Roggisch
Chris Withers ch...@simplistix.co.uk writes: Hi All, Is it just me or does the mailing of just about every single python-based project mailing list with a 90% form email advertising a conference that only has one python track *and* clashes with PyCon feel just a bit like spam? I know it's

Re: hashkey/digest for a complex object

2010-10-07 Thread Diez B. Roggisch
kj no.em...@please.post writes: In m2fwwjazs2@web.de de...@web.de (Diez B. Roggisch) writes: kj no.em...@please.post writes: The short version of this question is: where can I find the algorithm used by the tuple class's __hash__ method? Surprisingly, in the source:

[ANN] pywebkit - python bindings for webkit DOM (alpha)

2010-10-07 Thread lkcl
From: l...@lkcl.net To: python-list@python.org i've been kindly sponsored by http://www.samurai.com.br to create direct python bindings to webkit's DOM: http://www.gnu.org/software/pythonwebkit/ the significance of this project is that it makes python a peer of javascript when it comes to

[ANN] pywebkit - python bindings for webkit DOM (alpha)

2010-10-07 Thread lkcl
i've been kindly sponsored by http://www.samurai.com.br to create direct python bindings to webkit's DOM: http://www.gnu.org/software/pythonwebkit/ the significance of this project is that it makes python a peer of javascript when it comes to manipulating HTML through DOM functions (including

Re: hashkey/digest for a complex object

2010-10-07 Thread kj
In 87pqvmp611@web.de de...@web.de (Diez B. Roggisch) writes: I tried codesearch first. Not satisfied after 30 seconds with the results, I did the most straight forward thing - I downloaded and un-packed the python source... and took a look. From that I learned the tuplehash function name.

Re: hashkey/digest for a complex object

2010-10-07 Thread Diez B. Roggisch
kj no.em...@please.post writes: In 87pqvmp611@web.de de...@web.de (Diez B. Roggisch) writes: I tried codesearch first. Not satisfied after 30 seconds with the results, I did the most straight forward thing - I downloaded and un-packed the python source... and took a look. From that I

Re: hashkey/digest for a complex object

2010-10-07 Thread MRAB
On 07/10/2010 11:42, kj wrote: Inmailman.1415.1286438617.29448.python-l...@python.org Terry Reedytjre...@udel.edu writes: If these two attributes, and hence the dicts, are public, then your instances are mutable. I guess I should have written immutable among consenting adults. As far as

Data source path of a lyer file

2010-10-07 Thread Ahmed, Shakir
Hi, Is there any way that I can read the data source path of a .lyr file using Arc Object gp processor. Thanks sa -- http://mail.python.org/mailman/listinfo/python-list

Re: ConFoo spam?

2010-10-07 Thread Yannick Gingras
On October 7, 2010, Chris Withers wrote: Hi All, Is it just me or does the mailing of just about every single python-based project mailing list with a 90% form email advertising a conference that only has one python track and clashes with PyCon feel just a bit like spam? I know it's

Re: 64 bit offsets?

2010-10-07 Thread MRAB
On 06/10/2010 22:41, jay thompson wrote: Hello everyone, I'm trying to extract some data from a large memory mapped file (the largest is ~30GB) with re.finditer() and re.start(). Pythons regular expression module is great but the size of re.start() is 32bits (signed so I can really only address

Re: ConFoo spam?

2010-10-07 Thread Yannick Gingras
On October 7, 2010, Chris Withers wrote: Hi All, Is it just me or does the mailing of just about every single python-based project mailing list with a 90% form email advertising a conference that only has one python track and clashes with PyCon feel just a bit like spam? I know it's

Python Programmer needed in the LA area

2010-10-07 Thread Capstick, Antony H
I am looking for an experienced Person or Company located in Southern California to develop and implement a graphical track map operating in MS Windows that will be used to display graphical information for a new Disney attraction. Implementer Qualifications General requirements: *

Re: mantissa and exponent in base 10

2010-10-07 Thread C or L Smith
I just sent a similar suggestion to tutor: check out the %g format. print '%g' % 1.2345e7 1.2345e+07 print '%g' % 1.2345e-7 1.2345e-07 print '%g' % 1.2345 1.2345 def me(n, sigfigs = 4): ... s = ('%.'+'%ig' % sigfigs) % n # check docs for a better way? ... if 'e' in s: m, e = s.split('e')

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-07 Thread Diez B. Roggisch
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: In message 87d3rorf2f@web.de, Diez B. Roggisch wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: What exactly is the point of a BOM in a UTF-8-encoded file? It's a marker like the coding: utf-8 in

Re: ConFoo spam?

2010-10-07 Thread Jack Diederich
On Thu, Oct 7, 2010 at 7:56 AM, Diez B. Roggisch de...@web.de wrote: Chris Withers ch...@simplistix.co.uk writes: Is it just me or does the mailing of just about every single python-based project mailing list with a 90% form email advertising a conference that only has one python track *and*

Re: Python Programmer needed in the LA area

2010-10-07 Thread Jack Diederich
On Thu, Oct 7, 2010 at 11:55 AM, Capstick, Antony H antony.h.capst...@disney.com wrote: I am looking for an experienced Person .. to develop and implement a graphical track map operating in MS Windows that will be used to display graphical information for a new Disney attraction. 1)

Ordering tests in a testsuite

2010-10-07 Thread Ulrich Eckhardt
Hello! I'm currently working on a testsuite using Python's unittest library. This works all good and fine, but there's one thing where I haven't seen an elegant solution to yet, and that is the ordering. Currently, it takes all classes and orders them alphabetically and then takes all test

Re: mantissa and exponent in base 10

2010-10-07 Thread Jason Swails
On Thu, Oct 7, 2010 at 11:51 AM, C or L Smith smi...@worksmail.net wrote: I just sent a similar suggestion to tutor: check out the %g format. print '%g' % 1.2345e7 1.2345e+07 print '%g' % 1.2345e-7 1.2345e-07 print '%g' % 1.2345 1.2345 def me(n, sigfigs = 4): ... s = ('%.'+'%ig' %

Re: Ordering tests in a testsuite

2010-10-07 Thread Peter Otten
Ulrich Eckhardt wrote: I'm currently working on a testsuite using Python's unittest library. This works all good and fine, but there's one thing where I haven't seen an elegant solution to yet, and that is the ordering. Currently, it takes all classes and orders them alphabetically and then

Re: 64 bit offsets?

2010-10-07 Thread jay thompson
I'm not sure if it is limited to 32 bit addresses or if it's only re.start() that is limited to 'em. jt - It's quite difficult to remind people that all this stuff was here for a million years before people. So the idea that we are required to manage it is ridiculous. What we are having to

how to test for atomicity/mutability/hashability?

2010-10-07 Thread kj
I want to implement a test t() that will return True if its two arguments are completely different. By this I mean that they don't share any non-atomic component. E.g., if a = [0, 1] b = [0, 1] c = [2, 3] d = [2, 3] A = (a, c, 0) B = (a, d, 1) C = (b, d, 0) The desired test t() would

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 12:13 PM, kj no.em...@please.post wrote: snip It would facilitate the implementation of t() to have a simple test for mutability.  Is there one? Non-default hashability is an approximate heuristic: def is_immutable(x): try: hash(x) except TypeError:

Re: hashkey/digest for a complex object

2010-10-07 Thread Arnaud Delobelle
kj no.em...@please.post writes: The short version of this question is: where can I find the algorithm used by the tuple class's __hash__ method? Now, for the long version of this question, I'm working with some complext Python objects that I want to be able to compare for equality easily.

del() function - cannot find documentation

2010-10-07 Thread mafeusek
Hallo ML. there is following python script: mine = { 1: sd, 2: mk } del(mine[1]) print mine the problem is I cannot find any information about del() function in python 2.7 documentation. is it a documentation bug or I misunderstand something about del()? best regards, Pawel --

Re: del() function - cannot find documentation

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 1:12 PM, mafeu...@gmail.com wrote: Hallo ML. there is following python script: mine = { 1: sd, 2: mk } del(mine[1]) print mine the problem is I cannot find any information about del() function in python 2.7 documentation. is it a documentation bug or I

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Arnaud Delobelle
kj no.em...@please.post writes: I want to implement a test t() that will return True if its two arguments are completely different. By this I mean that they don't share any non-atomic component. E.g., if a = [0, 1] b = [0, 1] c = [2, 3] d = [2, 3] A = (a, c, 0) B = (a, d, 1) C = (b,

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 1:46 PM, Arnaud Delobelle arno...@gmail.com wrote: kj no.em...@please.post writes: I want to implement a test t() that will return True if its two arguments are completely different.  By this I mean that they don't share any non-atomic component.  E.g., if a = [0, 1]

Re: 64 bit offsets?

2010-10-07 Thread MRAB
On 07/10/2010 20:12, jay thompson wrote: I'm not sure if it is limited to 32 bit addresses or if it's only re.start() that is limited to 'em. jt From what I can tell, Microsoft compilers (I'm assuming you're using Windows) have a 32-bit 'int' type for both 32-bit and 64-bit builds, and the re

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Arnaud Delobelle
Chris Rebert c...@rebertia.com writes: On Thu, Oct 7, 2010 at 1:46 PM, Arnaud Delobelle arno...@gmail.com wrote: [...] I think defining mutability is subject to opinion, but here is a first approximation. def mutable(obj):    return obj.__hash__ is None or type(obj).__hash__ ==

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Christian Heimes
Am 07.10.2010 22:02, schrieb Chris Rebert: On Thu, Oct 7, 2010 at 12:13 PM, kj no.em...@please.post wrote: snip It would facilitate the implementation of t() to have a simple test for mutability. Is there one? Non-default hashability is an approximate heuristic: Except that every user

harmful str(bytes)

2010-10-07 Thread Hallvard B Furuseth
I've been playing a bit with Python3.2a2, and frankly its charset handling looks _less_ safe than in Python 2. The offender is bytes.__str__: str(b'foo') == b'foo'. It's often not clear from looking at a piece of code whether some data is treated as strings or bytes, particularly when translating

Re: Ordering tests in a testsuite

2010-10-07 Thread Ben Finney
Ulrich Eckhardt eckha...@satorlaser.com writes: However, sometimes it doesn't make sense to run test_bar() if test_foo() already failed, because they basically build upon each other. That's a mistake. If the success of ‘test_bar’ depends on the result of ‘test_foo’, then it's not an

frozendict (v0.1)

2010-10-07 Thread kj
Following a suggestion from MRAB, I attempted to implement a frozendict class. My implementation took a lot more work than something this simple should take, and it still sucks. So I'm hoping someone can show me a better way. Specifically, I'm hoping

Re: harmful str(bytes)

2010-10-07 Thread Arnaud Delobelle
Hallvard B Furuseth h.b.furus...@usit.uio.no writes: I've been playing a bit with Python3.2a2, and frankly its charset handling looks _less_ safe than in Python 2. The offender is bytes.__str__: str(b'foo') == b'foo'. It's often not clear from looking at a piece of code whether some data is

Re: frozendict (v0.1)

2010-10-07 Thread Arnaud Delobelle
kj no.em...@please.post writes: Following a suggestion from MRAB, I attempted to implement a frozendict class. My implementation took a lot more work than something this simple should take, and it still sucks. So I'm hoping someone can show me a better way. Specifically, I'm hoping that

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 2:28 PM, Christian Heimes li...@cheimes.de wrote: Am 07.10.2010 22:02, schrieb Chris Rebert: On Thu, Oct 7, 2010 at 12:13 PM, kj no.em...@please.post wrote: snip It would facilitate the implementation of t() to have a simple test for mutability.  Is there one?

Re: frozendict (v0.1)

2010-10-07 Thread Arnaud Delobelle
Oops I sent off my reply before I had finished! kj no.em...@please.post writes: Following a suggestion from MRAB, I attempted to implement a frozendict class. My implementation took a lot more work than something this simple should take, and it still sucks. So I'm hoping someone can show

Many newbie questions regarding python

2010-10-07 Thread Rogério Brito
Hi there. I am used to some languages like C, but I am just a complete newbie with Python and, while writing some small snippets, I had encountered some problems, with which I would sincerely appreciate any help, since I appreciate this language to write my running pseudocode in and I am

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-07 Thread Lawrence D'Oliveiro
In message 87hbgyosdc@web.de, Diez B. Roggisch wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: In message 87d3rorf2f@web.de, Diez B. Roggisch wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: What exactly is the point of a BOM in a

Re: Many newbie questions regarding python

2010-10-07 Thread MRAB
On 08/10/2010 00:10, Rogério Brito wrote: Hi there. I am used to some languages like C, but I am just a complete newbie with Python and, while writing some small snippets, I had encountered some problems, with which I would sincerely appreciate any help, since I appreciate this language to

Re: Many newbie questions regarding python

2010-10-07 Thread Andreas Waldenburger
On Thu, 07 Oct 2010 20:10:14 -0300 Rogério Brito rbr...@ime.usp.br wrote: I am used to some languages like C, but I am just a complete newbie with Python and, while writing some small snippets, I had encountered some problems, with which I would sincerely appreciate any help, since I

Re: Many newbie questions regarding python

2010-10-07 Thread Andreas Waldenburger
On Fri, 08 Oct 2010 00:46:41 +0100 MRAB pyt...@mrabarnett.plus.com wrote: In other words, don't try to write a C program in Python! Man, I'm good. :D /W -- To reach me via email, replace INVALID with the country code of my home country. But if you spam me, I'll be one sour kraut. --

Re: Many newbie questions regarding python

2010-10-07 Thread Tim Harig
On 2010-10-07, Rogério Brito rbr...@ime.usp.br wrote: 1 - The first issue that I am having is that I don't seem to be able to, say, use something that would be common for people writing programs in C: defining a one-dimensional vector and only initializing it when needed. For instance, in

Re: frozendict (v0.1)

2010-10-07 Thread kj
In 87hbgxlk67@gmail.com Arnaud Delobelle arno...@gmail.com writes: A simple fix is to use hash(frozenset(self.items())) instead. Thanks for pointing out the hash bug. It was an oversight: I meant to write def __hash__(self): return hash(sorted(tuple(self.items( I imagine

Re: Many newbie questions regarding python

2010-10-07 Thread Steven D'Aprano
On Thu, 07 Oct 2010 20:10:14 -0300, Rogério Brito wrote: What is the Pythonic way of writing code like this? So far, I have found many alternatives and I would like to write code that others in the Python community would find natural to read. Some of the things that crossed my mind: v

Re: frozendict (v0.1)

2010-10-07 Thread Steven D'Aprano
On Fri, 08 Oct 2010 00:23:30 +, kj wrote: In 87hbgxlk67@gmail.com Arnaud Delobelle arno...@gmail.com writes: A simple fix is to use hash(frozenset(self.items())) instead. Thanks for pointing out the hash bug. It was an oversight: I meant to write def __hash__(self):

Re: Ordering tests in a testsuite

2010-10-07 Thread Steven D'Aprano
On Fri, 08 Oct 2010 08:35:12 +1100, Ben Finney wrote: Ulrich Eckhardt eckha...@satorlaser.com writes: However, sometimes it doesn't make sense to run test_bar() if test_foo() already failed, because they basically build upon each other. That's a mistake. If the success of ‘test_bar’

Re: toy list processing problem: collect similar terms

2010-10-07 Thread sln
On Wed, 06 Oct 2010 10:52:19 -0700, s...@netherlands.com wrote: On Sat, 25 Sep 2010 21:05:13 -0700 (PDT), Xah Lee xah...@gmail.com wrote: here's a interesting toy list processing problem. I have a list of lists, where each sublist is labelled by a number. I need to collect together the contents

ANN: Roundup Issue Tracker 1.4.16 released

2010-10-07 Thread Richard Jones
I'm proud to release version 1.4.16 of Roundup which introduces some minor features and, as usual, fixes some bugs: Features: - allow trackers to override the classes used to render properties in templating per issue2550659 (thanks Ezio Melotti) - new mailgw configuration item

[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: See also issue #10039. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10014 ___

[issue1943] improved allocation of PyUnicode objects

2010-10-07 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Updated patch against current py3k. -- Added file: http://bugs.python.org/file19142/unialloc6.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1943

[issue9163] test_gdb fails

2010-10-07 Thread Tom Morris
Tom Morris tfmor...@gmail.com added the comment: Sorry, I misread the 'version' field as the version the fix was committed for, not the version the bug was reported against. The fix was reportedly fixed in r82648 and v2.7 is r82500. If there's ever a 2.7.1, I guess the fix will appear, but

[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The problem is that PySys_SetArgvEx() ... Not only PySys_SetArgvEx(). There is another issue with RunMainFromImporter() which do: sys.path[0] = filename -- ___ Python tracker

[issue2571] cmd.py always uses raw_input, even when another stdin is specified

2010-10-07 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Since 'we' can reopen any closed issue, I will try to answer what I think you might be asking. I closed this because of Daniel's suggestion coupled with the Richard disclaiming further interest and neither Raghuram nor any new responder

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-10-07 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I don't know if there is a point or not, but some hosts are for some reason intended to be connected to using IP address and their certificates thus contains IP addresses. I think we should support that too, and I find it a bit confusing to

[issue2142] difflib.unified_diff(...) produces invalid patches

2010-10-07 Thread Trent Mick
Changes by Trent Mick tre...@gmail.com: -- assignee: - trentm ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2142 ___ ___ Python-bugs-list mailing

[issue10028] test_concurrent_futures fails on Windows Server 2003

2010-10-07 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: I'm getting error 6 aka ERROR_INVALID_HANDLE. I'll try to figure out what's going on later this week if I can find time. I'll also run this on my Server 2008 machine to see how works. -- ___ Python

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-10-07 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Here is a new patch with doc updates and the corrections mentioned above. -- Added file: http://bugs.python.org/file19141/sslcheck2.patch ___ Python tracker rep...@bugs.python.org

[issue10039] python é.py fails with UnicodeEncodeErr or if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor
New submission from STINNER Victor victor.stin...@haypocalc.com: If a program name contains a non-ascii character in its name and/or full path and PYTHONFSENCODING is set to an encoding different than the locale encoding, Python fails to open the program. Example in the utf-8 locale: $

[issue10038] Returntype of json.loads() on strings

2010-10-07 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. fdr...@acm.org added the comment: As I understand it, the decision to return str instead of unicode values for the simplejson module was simply inherited by the standard library. As such, it still needs to be evaluated in the context of the standard library, because of the

[issue10040] GZipFile failure on large files

2010-10-07 Thread Robert Rohde
New submission from Robert Rohde ro...@robertrohde.com: I attempted to use GZipFile to process a 1.93 GB file that expands to 18.8 GB. This consistently produces the same corrupted output file that has approximately, but not exactly, the right output file size. I bypassed GZipFile by calling

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: i'm working on an independent py2to3 utility which directly imports py2x modules, by reverse compiling ast trees (code.google.com/p/asciiporn/source/browse/stable.py) while forward porting the python2x redis client, this issue came up. i kno

[issue9759] GzipFile object should raise ValueError on .read() after .close()

2010-10-07 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Patch committed in r85291 (3.x), and backported to 3.1 (r85293) and 2.7 (r85292). Thank you! -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker

[issue8584] test_multiprocessing skips some tests

2010-10-07 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: Fixed in r85299 (py3k), r85300 (release31-maint), and r85301 (release27-maint). -- assignee: jnoller - brian.curtin resolution: - fixed stage: patch review - committed/rejected status: open - closed versions: +Python 2.7

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-10-07 Thread Mads Kiilerich
Mads Kiilerich m...@kiilerich.com added the comment: Indeed. But, strictly speaking, there are no tests for IPs, so it shouldn't be taken for granted that it works, even for commonName. The rationale is that there isn't really any point in using an IP rather a host name. I don't know if

[issue9003] urllib.request and http.client should allow certificate checking

2010-10-07 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: A big warning is now present (*) in the urllib and httplib documentation pages. Also, once issue1589 is fixed, we can go forward and make {http.client,urllib.request} check hostname and cert if the user gives the location of a bunch of CA

[issue2571] cmd.py always uses raw_input, even when another stdin is specified

2010-10-07 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Can we reopen this as a feature request for 3.2? -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2571 ___

[issue10042] total_ordering stack overflow

2010-10-07 Thread Francesco Ricciardi
New submission from Francesco Ricciardi francesco.riccia...@hp.com: Tested with version 3.2a2. Not tested on version 2.7. The current implementation of functools.total_ordering generates a stack overflow because it implements the new comparison functions with inline operator, which the Python

[issue10042] total_ordering stack overflow

2010-10-07 Thread Francesco Ricciardi
Francesco Ricciardi francesco.riccia...@hp.com added the comment: Attached there is a solution of the problem, by implementing each comparison only with the class __xx__ and __eq__ operators. Also in the file there is a complete test suite for it. -- Added file:

  1   2   >