Fast decimal arithmetic module released

2009-10-03 Thread Stefan Krah
[As requested, repost from comp.lang.python] Hi, today I have released the following packages for fast arbitrary precision decimal arithmetic: 1. libmpdec Libmpdec is a C (C++ ready) library for arbitrary precision decimal arithmetic. It is a complete implementation of Mike

Re: Q: sort's key and cmp parameters

2009-10-03 Thread Raymond Hettinger
[Paul Rubin] The idea was that you have a list of trees that you want to sort, and an ordering relation between trees:    def gt(tree1, tree2): ... where you recursively descend both trees until you find an unequal pair of nodes.  You're not trying to sort the nodes within a single tree.

Re: Q: sort's key and cmp parameters

2009-10-03 Thread Raymond Hettinger
[Paul Rubin] The idea was that you have a list of trees that you want to sort, and an ordering relation between trees:    def gt(tree1, tree2): ... Are the trees user defined classes? Can the gt() function be added incorporated as __lt__ method so that you can just run a plain sort:

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-03 Thread Ben Finney
Philip Semanchuk phi...@semanchuk.com writes: Our project uses some libraries that were written by 3rd parties (i.e. not us). These libraries fit into a single Python file and live in our source tree alongside other modules we've written. Why in the same source tree? They are maintained

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-03 Thread Albert Hopkins
On Fri, 2009-10-02 at 20:22 -0400, Simon Forman wrote: 2.5 +1 I'd like to suggest 2.46 instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Chris Withers
Xah Lee wrote: Haskell has a new logo. A fantastic one. Beautiful. For creator, context, detail, see bottom of: What does this have to do with Python? Nothing. So why are you posting it to comp.lang.python? Chris -- Simplistix - Content Management, Batch Processing Python Consulting

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-03 Thread Francesco Bochicchio
On Oct 2, 9:50 pm, Philip Semanchuk phi...@semanchuk.com wrote: Hi all, PEP 8 http://www.python.org/dev/peps/pep-0008/ says the following:     Imports should be grouped in the following order:     1. standard library imports     2. related third party imports     3. local

Re: Q: sort's key and cmp parameters

2009-10-03 Thread Paul Rubin
Raymond Hettinger pyt...@rcn.com writes: Can you give an example of a list of trees and a cmp function that recursively compares them? Example of list of trees (nested dicts). In practice you could get such a list from the simplejson module: list_of_trees = [{'value':1,

Re: Q: sort's key and cmp parameters

2009-10-03 Thread Paul Rubin
Paul Rubin http://phr...@nospam.invalid writes: Example comparison function: def compare(tree1, tree2): c = cmp(tree1['value'], tree2['value']) if c != 0: return c c = cmp(tree1['left'], tree2['left']) if c != 0: return c return cmp(tree1['right'],

Trouble sending / receiving compressed data (using zlib) as HTTP POST to server (in django)

2009-10-03 Thread subeen
Hi, I am trying to send compressed data to a server written in django. But it shows error while decompressing the data in the server. After some experiment I found that the server is not receiving the exact data I am sending. data = 'hello, this is a test message this is another message' data =

Re: organizing your scripts, with plenty of re-use

2009-10-03 Thread Stef Mientki
bukzor wrote: I would assume that putting scripts into a folder with the aim of re- using pieces of them would be called a package, but since this is an anti-pattern according to Guido, apparently I'm wrong-headed here. (Reference:

Re: organizing your scripts, with plenty of re-use

2009-10-03 Thread Steven D'Aprano
On Fri, 02 Oct 2009 18:14:44 -0700, bukzor wrote: I would assume that putting scripts into a folder with the aim of re- using pieces of them would be called a package, A package is a special arrangement of folder + modules. To be a package, there must be a file called __init__.py in the

Calendar yr-mnth-day data to day since data

2009-10-03 Thread skorpi...@gmail.com
Hi all, I have some calendar data in three arrays corresponding to yr, month, day that I would like to convert to day since data and be consistent with changes in leap year. I've included a sample of the data structures below. Any suggestions??? Thanks in advance yr mnth

Re: Threaded GUI slowing method execution?

2009-10-03 Thread sturlamolden
On 2 Okt, 21:30, Dave Angel da...@ieee.org wrote: There could very well be multiprocess support in wxPython.  I'd check there first, before re-inventing the wheel. I don't think there is. But one can easily make a thread in the subprocess that polls a pipe and calls wx.PostEvent or

Re: re.sub do not replace portion of match

2009-10-03 Thread Duncan Booth
J Wolfe vorticitywo...@gmail.com wrote: Hi, Is there a way to flag re.sub not to replace a portion of the string? I have a very long string that I want to add two new line's to rather than one, but keep the value X: string = testX.\n.today -- note X is a value string =

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Robert H
http://blog.plover.com/prog/haskell/logo.html Oops... -- http://mail.python.org/mailman/listinfo/python-list

Re: organizing your scripts, with plenty of re-use

2009-10-03 Thread Steven D'Aprano
On Sat, 03 Oct 2009 10:24:13 +0200, Stef Mientki wrote: I still don't use (because I don't fully understand them) packages, but by trial and error I found a reasonable good working solution, with the following specifications I find that fascinating. You haven't used packages because you don't

The Python: Rag October issue available

2009-10-03 Thread Bernie
The Python: Rag October issue available The October issue of The Python: Rag is available at: http://www.pythonrag.org A monthly, free, community run, Python magazine - issues are in pdf format, intended for anyone interested in Python, without being particularly serious. If you have

re.sub do not replace portion of match

2009-10-03 Thread J Wolfe
Hi, Is there a way to flag re.sub not to replace a portion of the string? I have a very long string that I want to add two new line's to rather than one, but keep the value X: string = testX.\n.today -- note X is a value string = re.sub(testX.\n.,testX.\n\n., string)

Re: organizing your scripts, with plenty of re-use

2009-10-03 Thread Donn
Great description - wish the Python docs could be as clear. Thanks. \d -- http://mail.python.org/mailman/listinfo/python-list

Re: Q: sort's key and cmp parameters

2009-10-03 Thread Paul Rubin
Paul Rubin http://phr...@nospam.invalid writes: c = compare(tree1['left'], tree2['left']) Of course this recursive call crashes if either branch is None. Oh well, I'll stop trying to correct it since I'm sure you get the idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode text file

2009-10-03 Thread Junaid
On Sep 27, 6:39 pm, Mark Tolonen metolone+gm...@gmail.com wrote: Junaid junu...@gmail.com wrote in message news:0267bef9-9548-4c43-bcdf-b624350c8...@p23g2000vbl.googlegroups.com... I want to do replacements in a utf-8 text file. example f=open(test.txt,r) #this file is uft-8 encoded raw

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Tim Rowe
2009/10/3 Xah Lee xah...@gmail.com: for my criticism or comment on logos, typical response by these people are showcases of complete ignorance of social function of logos [snip and rearrange] discussed now and then in these communities often without my involvement. “you are a fucking

Re: Trouble sending / receiving compressed data (using zlib) as HTTP POST to server (in django)

2009-10-03 Thread Piet van Oostrum
subeen tamim.shahr...@gmail.com (s) wrote: s Hi, s I am trying to send compressed data to a server written in django. But s it shows error while decompressing the data in the server. After some s experiment I found that the server is not receiving the exact data I s am sending. s data = 'hello,

Re: Calendar yr-mnth-day data to day since data

2009-10-03 Thread Piet van Oostrum
skorpi...@gmail.com skorpi...@gmail.com (sc) wrote: sc Hi all, sc I have some calendar data in three arrays corresponding to yr, month, sc day that I would like to convert to day since data and be consistent sc with changes in leap year. I've included a sample of the data sc structures below.

Re: Fast decimal arithmetic module released

2009-10-03 Thread Stefan Krah
Mark Dickinson dicki...@gmail.com wrote: On Oct 2, 8:53 pm, Stefan Krah stefan-use...@bytereef.org wrote: Hi, today I have released the following packages for fast arbitrary precision decimal arithmetic: [...] Nice! I'd been wondering how you'd been finding all those decimal.py

Need feedback on subprocess-using function

2009-10-03 Thread gb345
I'm relatively new to Python, and I'm trying to get the hang of using Python's subprocess module. As an exercise, I wrote the Tac class below, which can prints output to a file in reverse order, by piping it through the Unix tac utility. (The idea is to delegate the problem of managing the

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Nick Keighley
On 3 Oct, 00:33, Xah Lee xah...@gmail.com wrote: Haskell has a new logo. A fantastic one. Beautiful. For creator, context, detail, see bottom of: • A Lambda Logo Tour  http://xahlee.org/UnixResource_dir/lambda_logo.html I'm amazed he thinks anyone would donate 3 USD to that site --

Enormous Input and Output Test

2009-10-03 Thread n00m
Hi, py.folk! I need your help to understand how http://www.spoj.pl/problems/INOUTEST/ can be passed in Python. I see two guys who managed to get accepted: http://www.spoj.pl/ranks/INOUTEST/lang=PYTH My code for this is: === import psyco psyco.full()

Re: setuptools, accessing ressource files

2009-10-03 Thread PJ Eby
On Oct 2, 7:04 am, Patrick Sabin patrick.just4...@gmail.com wrote: I use setuptools to create a package. In this package I included some images and I checked that they are in the egg-file. The problem is how can I access the images in the package? I tried pkgutil.get_data, but only got an

Re: Regular expression to structure HTML

2009-10-03 Thread 504cr...@gmail.com
On Oct 2, 11:14 pm, greg g...@cosc.canterbury.ac.nz wrote: Brian D wrote: This isn't merely a question of knowing when to use the right tool. It's a question about how to become a better developer using regular expressions. It could be said that if you want to learn how to use a hammer,

Customizing Option Elements

2009-10-03 Thread Victor Subervi
Hi; I want to create option elements within a select element in which I could insert html, which, of course, is illegal (don't tell the police ;) so I'm looking at recreating the form elements using my own customized elements, that is, hacking the equivalent from scratch, but how do I proceed? I

Re: Q: sort's key and cmp parameters

2009-10-03 Thread kj
In 7xtyyhikrl@ruckus.brouhaha.com Paul Rubin http://phr...@nospam.invalid writes: Python 2.x provides two ways and you can use whichever one fits the application better. I have never understood why Python 3.x finds it necessary to break one of them. Maybe I can migrate to Haskell by the

Re: The Python: Rag October issue available

2009-10-03 Thread Bernie
On Fri, 02 Oct 2009 11:32:41 -0700, steven.oldner wrote: Hi, no -its just put on the website. Unless there's a method you can suggest? Cheers Bernie On Oct 2, 11:14 am, Bernie edi...@pythonrag.org wrote: The Python: Rag October issue available The October issue of The Python: Rag

Re: AJAX Widget Framework

2009-10-03 Thread Mathias Waack
Laszlo Nagy wrote: I'm looking for an open source, AJAX based widget/windowing framework. Here is what I need: - end user opens up a browser, points it to a URL, logs in - on the server site, sits my application, creating a new session for each user that is logged in - on the server site,

PIL : How to write array to image ???

2009-10-03 Thread Martin
Dear group I'm trying to use PIL to write an array (a NumPy array to be exact) to an image. Peace of cake, but it comes out looking strange. I use the below mini code, that I wrote for the purpose. The print of a looks like expected: [[ 200. 200. 200. ...,0.0.0.] [ 200. 200.

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Jack Diederich
It's Xah Lee, he's been trolling this and every other programing language group for over 10 years (preferably all at once). Let it go. On Sat, Oct 3, 2009 at 2:53 AM, Chris Withers ch...@simplistix.co.uk wrote: Xah Lee wrote: Haskell has a new logo. A fantastic one. Beautiful. For creator,

Re: Q: sort's key and cmp parameters

2009-10-03 Thread Paul Rubin
kj no.em...@please.post writes: !!! Maybe Haskell is much handier than I give it credit for, but it's hard for me to imagine that it is as convenient as Python 3, even without the cmp sort option... Heh, yeah, I was being a bit snarky/grouchy. Haskell has a very steep learning curve and

Re: Python resident memory retention Evan Jones' improvements

2009-10-03 Thread Matt Ernst
On Oct 2, 4:47 pm, Andrew MacIntyre andy...@bullseye.apana.org.au wrote: There are two things you need to be aware of in this situation: - not all Python's memory is allocated through Python's specialised    malloc() - int and float objects in particular (in 2.x at least) are    allocated

Re: PIL : How to write array to image ???

2009-10-03 Thread Robert Kern
Martin wrote: Dear group I'm trying to use PIL to write an array (a NumPy array to be exact) to an image. Peace of cake, but it comes out looking strange. I use the below mini code, that I wrote for the purpose. The print of a looks like expected: [[ 200. 200. 200. ...,0.0.0.]

Re: Customizing Option Elements

2009-10-03 Thread Laszlo Nagy
I want to create option elements within a select element in which I could insert html, which, of course, is illegal (don't tell the police ;) so I'm looking at recreating the form elements using my own customized elements, that is, hacking the equivalent from scratch, but how do I proceed? I

Re: PIL : How to write array to image ???

2009-10-03 Thread Peter Otten
Martin wrote: Dear group I'm trying to use PIL to write an array (a NumPy array to be exact) to an image. Peace of cake, but it comes out looking strange. I use the below mini code, that I wrote for the purpose. The print of a looks like expected: [[ 200. 200. 200. ...,0.0.

Re: question about the GC implementation

2009-10-03 Thread ryles
On Oct 2, 11:20 am, Francis Moreau francis.m...@gmail.com wrote: Hello, I'm looking at gcmodule.c and in move_unreachable() function, the code assumes that if an object has its gc.gc_refs stuff to 0 then it *may* be unreachable. How can an object tagged as unreachable could suddenly become

Is pythonic version of scanf() or sscanf() planned?

2009-10-03 Thread ryniek90
Hi I know that in python, we can do the same with regexps or *.split()*, but thats longer and less practical method than *scanf()*. I also found that ( http://code.activestate.com/recipes/502213/ ), but the code doesn't looks so simple for beginners. So, whether it is or has been planned the

Re: Dictionary with Lists

2009-10-03 Thread Mick Krippendorf
Hi, Shaun wrote: I'm trying to create a dictionary with lists as the value for each key. I was looking for the most elegant way of doing it... from collections import defaultdict d = defaultdict(list) d[joe].append(something) d[joe].append(another) d[jim].append(slow down, grasshopper)

Re: Dictionary with Lists

2009-10-03 Thread Mel
Shaun wrote: testDict = {} ... testDict [1] = testDict.get (1, []).append (Test0) # 1 does not exist, create empty array print testDict testDict [1] = testDict.get (1, []).append (Test1) print testDict [ ... ] However, the first printout gives {1: None} instead of the desired {1:

Re: Is pythonic version of scanf() or sscanf() planned?

2009-10-03 Thread MRAB
ryniek90 wrote: Hi I know that in python, we can do the same with regexps or *.split()*, but thats longer and less practical method than *scanf()*. I also found that ( http://code.activestate.com/recipes/502213/ ), but the code doesn't looks so simple for beginners. So, whether it is or has

Re: Enormous Input and Output Test

2009-10-03 Thread Chris Rebert
On Sat, Oct 3, 2009 at 6:54 AM, n00m n...@narod.ru wrote: Hi, py.folk! I need your help to understand how http://www.spoj.pl/problems/INOUTEST/ can be passed in Python. snip def foo():    ##sys.stdin = open('D:/1583.txt', 'rt')    a = sys.stdin.readlines() That line is probably a Very Bad

Re: Enormous Input and Output Test

2009-10-03 Thread Terry Reedy
n00m wrote: Hi, py.folk! I need your help to understand how http://www.spoj.pl/problems/INOUTEST/ can be passed in Python. I see two guys who managed to get accepted: http://www.spoj.pl/ranks/INOUTEST/lang=PYTH My code for this is: === import psyco

Re: Haskell's new logo, and the idiocy of tech geekers

2009-10-03 Thread Michel Alexandre Salim
On Oct 2, 7:33 pm, Xah Lee xah...@gmail.com wrote: Haskell has a new logo. A fantastic one. Beautiful. For creator, context, detail, see bottom of: • A Lambda Logo Tour  http://xahlee.org/UnixResource_dir/lambda_logo.html Interesting.. rant. Thanks for the logo collection, though, some of

Problem with subprocess module on Windows with open file in append mode

2009-10-03 Thread Andrew Savige
When I run this little test program on Linux: import subprocess subprocess.call([python,-V], stderr=open(log.tmp,a)) the file log.tmp is appended to each time I run it. When I run it on Windows, however, the file log.tmp gets overwritten each time I run it. Though I can make it append on

Re: Calendar yr-mnth-day data to day since data

2009-10-03 Thread skorpi...@gmail.com
On Oct 3, 6:35 am, Piet van Oostrum p...@cs.uu.nl wrote: skorpi...@gmail.com skorpi...@gmail.com (sc) wrote: sc Hi all, sc I have some calendar data in three arrays corresponding to yr, month, sc day that I would like to convert to day since data and be consistent sc with changes in leap

Re: Is pythonic version of scanf() or sscanf() planned?

2009-10-03 Thread Grant Edwards
On 2009-10-03, ryniek90 rynie...@gmail.com wrote: So, whether it is or has been planned the core Python implementation of *scanf()* ? One of the fist things I remember being taught as a C progrmmer was to never use scanf. Programs that use scanf tend to fail in rather spectacular ways when

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
On Oct 4, 2:29 am, Chris Rebert c...@rebertia.com wrote: That line is probably a Very Bad Idea (TM) as it reads the *entire* enormous file into memory *at once*. It would probably be much better to iterate over the file, thus only reading one individual line at a time. I'm betting the

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
PS Time Limit for this problem = 20s -- http://mail.python.org/mailman/listinfo/python-list

Identify runs in list

2009-10-03 Thread skorpi...@gmail.com
Hi all, I have a data structure in a list as in: [0 0 0 3 0 5 0 0 0 0 1 0 4 0 5 0 0 7 0 0 0 0 0 12 0 0 4] I would like to extract three list from this data: 1) runsOfZero: [3 4 5] 2) runsOfNonZero: [3 8 4] 3) SumOfRunsOfNonZero: [8 17 16] Any suggestions would be appreciated --

Re: Identify runs in list

2009-10-03 Thread Chris Rebert
On Sat, Oct 3, 2009 at 7:21 PM, skorpi...@gmail.com skorpi...@gmail.com wrote: Hi all, I have a data structure in a list as in: [0 0 0 3 0 5 0 0 0 0 1 0 4 0 5 0 0 7 0 0 0 0 0 12 0 0 4] I would like to extract three list from this data: 1) runsOfZero: [3 4 5] 2) runsOfNonZero: [3 8 4] 3)

Re: Identify runs in list

2009-10-03 Thread skorpi...@gmail.com
On Oct 3, 10:36 pm, Chris Rebert c...@rebertia.com wrote: On Sat, Oct 3, 2009 at 7:21 PM, skorpi...@gmail.com skorpi...@gmail.com wrote: Hi all, I have a data structure in a list as in: [0 0 0 3 0 5 0 0 0 0 1 0 4 0 5 0 0 7 0 0 0 0 0 12 0 0 4] I would like to extract three list from

Re: Identify runs in list

2009-10-03 Thread Chris Rebert
On Sat, Oct 3, 2009 at 7:53 PM, skorpi...@gmail.com skorpi...@gmail.com wrote: On Oct 3, 10:36 pm, Chris Rebert c...@rebertia.com wrote: snip Since this sounds like homework, I won't give actual code, but here's a gameplan: 1. Split the list into sublists based on where the runs of zeros stop

Re: The Python: Rag October issue available

2009-10-03 Thread TerryP
On Oct 3, 4:29 pm, Bernie edi...@pythonrag.org wrote: Hi, no -its just put on the website.  Unless there's a method you can suggest? Not to butt in, but off the top of my head, you could probably set up a mailing list and post the link to the file every cycle - simple but effective. --

creating class objects inside methods

2009-10-03 Thread horos11
All, I've got a strange one.. I'm trying to create a class object inside another class object by using the code template below (note.. this isn't the exact code.. I'm having difficulty reproducing it without posting the whole thing) Anyways, the upshot is that the first time the Myclass()

Re: Enormous Input and Output Test

2009-10-03 Thread alex23
On Oct 3, 11:54 pm, n00m n...@narod.ru wrote: I need your help to understand howhttp://www.spoj.pl/problems/INOUTEST/ can be passed in Python. My code for this is: === import psyco psyco.full() import sys def noo(b):     b = b.split()     return

Re: creating class objects inside methods

2009-10-03 Thread Simon Forman
On Sat, Oct 3, 2009 at 11:32 PM, horos11 horo...@gmail.com wrote: All, I've got a strange one.. I'm trying to create a class object inside another class object by using the code template below (note.. this isn't the exact code.. I'm having difficulty reproducing it without posting the whole

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
Do you know how big the input data set actually is? Of course, I don't know exact size of input. It's several MBs, I guess. And mind the fact: their testing machines are PIII (750MHz). -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary with Lists

2009-10-03 Thread John Nagle
Shaun wrote: Hi, I'm trying to create a dictionary with lists as the value for each key. I was looking for the most elegant way of doing it... Try using a tuple, instead of a list, for each key. Tuples are immutable, so there's no issue about a key changing while being used in a

Re: Enormous Input and Output Test

2009-10-03 Thread alex23
On Oct 4, 1:58 pm, n00m n...@narod.ru wrote: Do you know how big the input data set actually is? Of course, I don't know exact size of input. It's several MBs, I guess. And mind the fact: their testing machines are PIII (750MHz). Well, then, that's moved the problem from challenging to

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
On my machine, the above code handles ~50MB in ~10sec. Means their input 40-50MB 2. I just see: two guys did it in Python and I feel myself curious how on earth?. -- http://mail.python.org/mailman/listinfo/python-list

Re: Identify runs in list

2009-10-03 Thread Paul Rubin
skorpi...@gmail.com skorpi...@gmail.com writes: Any suggestions would be appreciated Look at the docs of the groupby function in the itertools module. -- http://mail.python.org/mailman/listinfo/python-list

Re: creating class objects inside methods

2009-10-03 Thread horos11
a __main__.Myclass instance at 0x95cd3ec b __main__.Myclass instance at 0x95cd5ac What's the problem? Like I said, the code was a sample of what I was trying to do, not the entire thing.. I just wanted to see if the metaphor was kosher. It sounds to me from your answer that this is

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
And *without* Psyco the above code gets TLE verdict... A kind of mystery :( -- http://mail.python.org/mailman/listinfo/python-list

Re: creating class objects inside methods

2009-10-03 Thread horos11
Anyways, I see what's going on here: With the line, for state in curstate.next_states(): if not state.to_string() in seen_states: dq.append(state) Inadvertently using the name of a module as a variable seems to be causing this. In any case, this shouldn't cause issues with

Re: Enormous Input and Output Test

2009-10-03 Thread John Yeung
On Oct 3, 11:58 pm, n00m n...@narod.ru wrote: Do you know how big the input data set actually is? Of course, I don't know exact size of input. It's several MBs, I guess. And mind the fact: their testing machines are PIII (750MHz). You know the maximum size of the input, if you can trust the

[issue7006] The replacement suggested for callable(x) in py3k is not equivalent

2009-10-03 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Benjamin already replaced hasattr(x, __call__) with hasattr(type(x), __call__) in the Python 3.0 What's New in r75090 and r75094, but this still doesn't match completely the behavior of callable(): class Foo(object): pass ... foo = Foo()

[issue7042] test_signal fails on os x 10.6

2009-10-03 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: This is a 64 bit machine and the test failed for the checkout of the python26-maint branch. I just configured and made it without any flags. (Does that produce a 64 bit build?) -- ___ Python

[issue7019] unmarshaling of artificial strings can produce funny longs.

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: 2.6 fix applied in r75203. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7019 ___

[issue7045] utf-8 encoding error

2009-10-03 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: I can't reproduce that; it prints fine for me. Notice that it is perfectly fine for Python to represent this as two code points in UCS-2 mode (so that len(s)==2); this is called UTF-16. -- nosy: +loewis

[issue7042] test_signal fails on os x 10.6

2009-10-03 Thread Ned Deily
Ned Deily n...@acm.org added the comment: By default, 10.6 prefers to run 64-bit architectures when available. You can easily tell whether a python 2.x is running as 32-bit or 64-bit by checking sys.maxint: $ /usr/local/bin/python2.6 -c 'import sys; print sys.maxint' 2147483647 $

[issue7033] C/API - Document exceptions

2009-10-03 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Sounds like a useful new API. Two comments: * The version without *base* is not needed. Passing an explicit NULL for *base* is easy enough. * The name PyErr_Create is needlessly different from PyErr_NewException. Something like

[issue7042] test_signal fails on os x 10.6

2009-10-03 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: $ ./python.exe -c 'import sys; print sys.maxint' 9223372036854775807 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7042 ___

[issue7045] utf-8 encoding error

2009-10-03 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I can't reproduce it either on Ubuntu 9.04 32-bit. I tried both from the terminal and from the file, using Py3.2a0. As Martin said, the fact that in narrow builds of Python the codepoints outside the BMP are represented with two surrogate

[issue7028] Add int.hex for symmetry with float.hex

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Rejecting the request to add int.hex. I've added a note to the hex() docs pointing to float.hex(), in revisions r75025 through r75028. It doesn't really seem worth adding pointers from float.hex and float.fromhex back to integer analogues:

[issue7006] The replacement suggested for callable(x) in py3k is not equivalent

2009-10-03 Thread Trundle
Trundle andy-pyt...@hammerhartes.de added the comment: As every type is an instance of `type`, every type also has a `__call__` attribute which means ``hasattr(type(x), '__call__')`` is always true. `callable()` checks whether `tp_call` is set on the type, which cannot be done in Python

[issue7045] utf-8 encoding error

2009-10-03 Thread Arc Riley
Arc Riley arcri...@gmail.com added the comment: Python 3.1.1 (r311:74480, Sep 13 2009, 22:19:17) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. import sys sys.maxunicode 1114111 u = 'ё' print(u) Traceback (most recent call last): File stdin, line 1, in

[issue7046] decimal.py: use DivisionImpossible and DivisionUndefined

2009-10-03 Thread Stefan Krah
New submission from Stefan Krah stefan-use...@bytereef.org: In many cases, decimal.py sets InvalidOperation instead of DivisionImpossible or DivisionUndefined. Mark, could I persuade you to isolate these cases by running a modified deccheck2.py from mpdecimal (See attachment), which does not

[issue7047] decimal.py: NaN payload conversion

2009-10-03 Thread Stefan Krah
New submission from Stefan Krah stefan-use...@bytereef.org: decimal.py sets InvalidOperation if the payload of a NaN is too large: c = getcontext() c.prec = 4 c.create_decimal(NaN12345) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.7/decimal.py,

[issue7047] decimal.py: NaN payload conversion

2009-10-03 Thread Stefan Krah
Changes by Stefan Krah stefan-use...@bytereef.org: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7047 ___ ___

[issue7048] decimal.py: logb: round the result if it is greater than prec

2009-10-03 Thread Stefan Krah
New submission from Stefan Krah stefan-use...@bytereef.org: from decimal import * c = getcontext() c.prec = 2 c.logb(Decimal(1E123456)) Decimal('123456') This result agrees with the result of decNumber, but the spec says: All results are exact unless an integer result does not fit in the

[issue7049] decimal.py: NaN result in pow(x, y, z) with prec 1

2009-10-03 Thread Stefan Krah
New submission from Stefan Krah stefan-use...@bytereef.org: If precision 1 is aupported, the following results should not be NaN: Python 2.7a0 (trunk:74738, Sep 10 2009, 11:50:08) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. from decimal import *

[issue7049] decimal.py: NaN result in pow(x, y, z) with prec 1

2009-10-03 Thread Stefan Krah
Changes by Stefan Krah stefan-use...@bytereef.org: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7049 ___ ___

[issue2821] unittest.py sys.exit error

2009-10-03 Thread Mark Fitzgerald
Mark Fitzgerald mark.fitzgera...@sympatico.ca added the comment: Agreed that this is clearly not a bug. One way to get the desired behavior from IDLE is to move up to Python 2.7a0+ or Python 3.1.1+, where the 'exit' parameter of unittest.main(), which when set to False, disables the sys.exit()

[issue7050] (x,y) += (1,2) crashes IDLE

2009-10-03 Thread Mark Fitzgerald
New submission from Mark Fitzgerald mark.fitzgera...@sympatico.ca: Start up IDLE. Type (x,y) += (1,2) (without the double-quotes), then press Enter. IDLE unexpectedly terminates without message, pop-up, or warning. Admittedly, this line of code is likely not legal, but shouldn't it just raise

[issue7050] Augmented assignment of tuple crashes IDLE

2009-10-03 Thread Mark Fitzgerald
Changes by Mark Fitzgerald mark.fitzgera...@sympatico.ca: -- title: (x,y) += (1,2) crashes IDLE - Augmented assignment of tuple crashes IDLE ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7050

[issue7046] decimal.py: use DivisionImpossible and DivisionUndefined

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Just to be clear, the decimal context doesn't (and shouldn't) know about DivisionImpossible: there's no DivisionImpossible signal or trap described in the specification, but just a DivisionImpossible heading in the 'exceptional

[issue7047] decimal.py: NaN payload conversion

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: This is essentially the same issue as issue 7046: the relevant lines in decimal.py read: if d._isnan() and len(d._int) self.prec - self._clamp: return self._raise_error(ConversionSyntax,

[issue7046] decimal.py: use DivisionImpossible and DivisionUndefined

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Closed issue 7047 as a duplicate of this one: _raise_error(ConversionSyntax) also raises (if trapped) the InvalidOperation exception, when it could reasonably raise ConversionSyntax instead. It's the same cause as above: _raise_error

[issue7046] decimal.py: use DivisionImpossible and DivisionUndefined

2009-10-03 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - mark.dickinson priority: - normal stage: - needs patch type: - behavior versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org

[issue7049] decimal.py: NaN result in pow(x, y, z) with prec 1

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: This behaviour was deliberate: since the standard doesn't cover three- argument pow, I more-or-less made up my own rules here. :) In this case, I (somewhat arbitrarily) decided that to ensure that any possible pow(a, b, m) result could be

[issue7048] decimal.py: logb: round the result if it is greater than prec

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Hmm. The problem here is that the specification says nothing at all about what should happen if the integer result does *not* fit in the available precision, so in this case we went with the decNumber behaviour. Rather than rounding, I'd

[issue5911] built-in compile() should take encoding option.

2009-10-03 Thread Naoki INADA
Naoki INADA songofaca...@gmail.com added the comment: add sample implementation. -- keywords: +patch Added file: http://bugs.python.org/file15030/compile_with_encoding.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5911

[issue7049] decimal.py: NaN result in pow(x, y, z) with prec 1

2009-10-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Unless anyone else disagrees, I'm going to call this a 'won't fix': I'm happy with the current behaviour. I would like to relax the condition on the modulus from 'modulus 10**prec' to 'modulus = 10**prec', though, so I'm leaving the

  1   2   >